sf mono + symbols nerd font, modeline, rust-mode

This commit is contained in:
Janis 2024-12-26 15:54:58 +01:00
parent fe09732b80
commit d9f7ec85f5

View file

@ -194,7 +194,6 @@ Add package repositories and rank them by priority
** Global Variables
#+begin_src emacs-lisp
(set-language-environment "UTF-8")
(column-number-mode t) ;; Show current column number in mode line
(delete-selection-mode t) ;; Replace selected text when yanking
(dirtrack-mode t) ;; Directory tracking in shell
(global-so-long-mode t) ;; Mitigate performance for long lines
@ -324,9 +323,13 @@ Font size [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attri
(set-face-attribute 'fixed-pitch nil :font "monospace" :height nemo/font-height-mono)
(set-face-attribute 'variable-pitch nil :font "sans-serif" :height nemo/font-height-sans)
(when (member "SF Mono" (font-family-list))
(set-face-attribute 'default nil :font "SF Mono" :height nemo/font-height-mono)
(set-face-attribute 'fixed-pitch nil :family "SF Mono" :height nemo/font-height-mono))
;; (when (member "SF Mono" (font-family-list))
;; (set-face-attribute 'default nil :font "SF Mono" :height nemo/font-height-mono)
;; (set-face-attribute 'fixed-pitch nil :family "SF Mono" :height nemo/font-height-mono))
(defvar nemo/nerd-fonts-font "Symbols Nerd Font")
(when (member nemo/nerd-fonts-font (font-family-list))
(set-fontset-font t nil (font-spec :height nemo/font-height-mono :font "Symbols Nerd Font")))
(when (member "SF Pro Text" (font-family-list))
(set-face-attribute 'variable-pitch nil :family "SF Pro Text" :height nemo/font-height-sans))
@ -356,20 +359,20 @@ Use both fixed and variable pitched fonts and faces.
Honestly not very happy with this at the moment, but it's kind of hacked together based on Sophie's and Amit's modelines.
#+begin_src emacs-lisp
;; Mode line setup
(column-number-mode t) ;; Show current column number in mode line
(setq-default
mode-line-format
'(" "
(:propertize "λ" face font-lock-comment-face)
'((:propertize "λ" face mode-line-emphasis)
" "
mode-line-buffer-identification
" "
; read-only or modified status
(:eval
(cond (buffer-read-only
(propertize " RO " 'face 'mode-line-read-only-face))
(propertize "  " 'face 'mode-line-read-only-face))
((buffer-modified-p)
(propertize " ** " 'face 'mode-line-modified-face))
(t " ")))
(propertize " 󰳻 " 'face 'mode-line-modified-face))
(t "  " 'face 'mode-line)))
; directory and buffer/file name
(:propertize (:eval (shorten-directory default-directory 30))
face mode-line-folder-face)
@ -378,20 +381,23 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
;; Version control info
(:eval (when-let (vc vc-mode)
;; Use a pretty branch symbol in front of the branch name
(list (propertize "  " 'face 'font-lock-comment-face)
(list (propertize " " 'face 'font-lock-keyword-face)
(propertize (substring vc 5)
'face 'font-lock-comment-face))))
'face 'font-lock-doc-face))))
" "
(:propertize mode-name)
(:propertize (length local-minor-modes))
; (global-mode-string global-mode-string)
(:eval (propertize
" " 'display
`((space :align-to
(- (+ right right-fringe right-margin)
,(+ 2 (string-width "%4l:%c")))))))
,(+ 1 (string-width "%p %4l:%c")))))))
;; Line and column numbers
mode-line-percent-position
" "
(:propertize "%4l:" face mode-line-position-face)
(:eval (propertize "%c" 'face
(if (>= (current-column) 80)
@ -1458,12 +1464,12 @@ hlsl-mode:
** Rust
[[https://github.com/rust-lang/rust-mode][=rust-mode=]]
#+begin_src emacs-lisp
(use-package rust-mode
:straight t
;; :hook (rust-mode . lsp-mode)
:init
(setq rust-mode-treesitter-derive t
))
;; (use-package rust-mode
;; :straight t
;; ;; :hook (rust-mode . lsp-mode)
;; :init
;; (setq rust-mode-treesitter-derive t
;; ))
#+end_src
[[https://github.com/brotzeit/rustic][=rustic-mode=]]
@ -1498,7 +1504,10 @@ hlsl-mode:
)
:config
(setq rustic-format-on-save t
rustic-format-on-save-method #'rustic-format-buffer
rust-format-on-save t
rust-mode-treesitter-derive t
rustic-format-trigger 'on-save
;; rustic-format-on-save-method #'rustic-format-buffer
rustic-analyzer-command '("/usr/bin/rust-analyzer")
)
)