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 ** Global Variables
#+begin_src emacs-lisp #+begin_src emacs-lisp
(set-language-environment "UTF-8") (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 (delete-selection-mode t) ;; Replace selected text when yanking
(dirtrack-mode t) ;; Directory tracking in shell (dirtrack-mode t) ;; Directory tracking in shell
(global-so-long-mode t) ;; Mitigate performance for long lines (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 'fixed-pitch nil :font "monospace" :height nemo/font-height-mono)
(set-face-attribute 'variable-pitch nil :font "sans-serif" :height nemo/font-height-sans) (set-face-attribute 'variable-pitch nil :font "sans-serif" :height nemo/font-height-sans)
(when (member "SF Mono" (font-family-list)) ;; (when (member "SF Mono" (font-family-list))
(set-face-attribute 'default nil :font "SF Mono" :height nemo/font-height-mono) ;; (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)) ;; (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)) (when (member "SF Pro Text" (font-family-list))
(set-face-attribute 'variable-pitch nil :family "SF Pro Text" :height nemo/font-height-sans)) (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. 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 #+begin_src emacs-lisp
;; Mode line setup ;; Mode line setup
(column-number-mode t) ;; Show current column number in mode line
(setq-default (setq-default
mode-line-format mode-line-format
'(" " '((:propertize "λ" face mode-line-emphasis)
(:propertize "λ" face font-lock-comment-face)
" " " "
mode-line-buffer-identification mode-line-buffer-identification
" " " "
; read-only or modified status ; read-only or modified status
(:eval (:eval
(cond (buffer-read-only (cond (buffer-read-only
(propertize " RO " 'face 'mode-line-read-only-face)) (propertize "  " 'face 'mode-line-read-only-face))
((buffer-modified-p) ((buffer-modified-p)
(propertize " ** " 'face 'mode-line-modified-face)) (propertize " 󰳻 " 'face 'mode-line-modified-face))
(t " "))) (t "  " 'face 'mode-line)))
; directory and buffer/file name ; directory and buffer/file name
(:propertize (:eval (shorten-directory default-directory 30)) (:propertize (:eval (shorten-directory default-directory 30))
face mode-line-folder-face) 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 ;; Version control info
(:eval (when-let (vc vc-mode) (:eval (when-let (vc vc-mode)
;; Use a pretty branch symbol in front of the branch name ;; 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) (propertize (substring vc 5)
'face 'font-lock-comment-face)))) 'face 'font-lock-doc-face))))
" " " "
(:propertize mode-name) (:propertize mode-name)
(:propertize (length local-minor-modes))
; (global-mode-string global-mode-string) ; (global-mode-string global-mode-string)
(:eval (propertize (:eval (propertize
" " 'display " " 'display
`((space :align-to `((space :align-to
(- (+ right right-fringe right-margin) (- (+ right right-fringe right-margin)
,(+ 2 (string-width "%4l:%c"))))))) ,(+ 1 (string-width "%p %4l:%c")))))))
;; Line and column numbers ;; Line and column numbers
mode-line-percent-position
" "
(:propertize "%4l:" face mode-line-position-face) (:propertize "%4l:" face mode-line-position-face)
(:eval (propertize "%c" 'face (:eval (propertize "%c" 'face
(if (>= (current-column) 80) (if (>= (current-column) 80)
@ -1458,12 +1464,12 @@ hlsl-mode:
** Rust ** Rust
[[https://github.com/rust-lang/rust-mode][=rust-mode=]] [[https://github.com/rust-lang/rust-mode][=rust-mode=]]
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package rust-mode ;; (use-package rust-mode
:straight t ;; :straight t
;; :hook (rust-mode . lsp-mode) ;; ;; :hook (rust-mode . lsp-mode)
:init ;; :init
(setq rust-mode-treesitter-derive t ;; (setq rust-mode-treesitter-derive t
)) ;; ))
#+end_src #+end_src
[[https://github.com/brotzeit/rustic][=rustic-mode=]] [[https://github.com/brotzeit/rustic][=rustic-mode=]]
@ -1498,7 +1504,10 @@ hlsl-mode:
) )
:config :config
(setq rustic-format-on-save t (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") rustic-analyzer-command '("/usr/bin/rust-analyzer")
) )
) )