sf mono + symbols nerd font, modeline, rust-mode
This commit is contained in:
parent
fe09732b80
commit
d9f7ec85f5
213
init.org
213
init.org
|
@ -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
|
||||
|
@ -320,16 +319,20 @@ Font size [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attri
|
|||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(set-face-attribute 'default 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 'default 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)
|
||||
|
||||
(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 "SF Pro Text" (font-family-list))
|
||||
(set-face-attribute 'variable-pitch nil :family "SF Pro Text" :height nemo/font-height-sans))
|
||||
(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))
|
||||
#+end_src
|
||||
|
||||
Use nerd-icons and apple emojis
|
||||
|
@ -355,97 +358,100 @@ Use both fixed and variable pitched fonts and faces.
|
|||
** Mode Line
|
||||
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
|
||||
(setq-default
|
||||
mode-line-format
|
||||
'(" "
|
||||
(:propertize "λ" face font-lock-comment-face)
|
||||
" "
|
||||
mode-line-buffer-identification
|
||||
" "
|
||||
; read-only or modified status
|
||||
(:eval
|
||||
(cond (buffer-read-only
|
||||
(propertize " RO " 'face 'mode-line-read-only-face))
|
||||
((buffer-modified-p)
|
||||
(propertize " ** " 'face 'mode-line-modified-face))
|
||||
(t " ")))
|
||||
; directory and buffer/file name
|
||||
(:propertize (:eval (shorten-directory default-directory 30))
|
||||
face mode-line-folder-face)
|
||||
(:propertize "%b"
|
||||
face mode-line-filename-face)
|
||||
;; 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)
|
||||
(propertize (substring vc 5)
|
||||
'face 'font-lock-comment-face))))
|
||||
;; Mode line setup
|
||||
(column-number-mode t) ;; Show current column number in mode line
|
||||
(setq-default
|
||||
mode-line-format
|
||||
'((:propertize "λ" face mode-line-emphasis)
|
||||
" "
|
||||
mode-line-buffer-identification
|
||||
" "
|
||||
; read-only or modified status
|
||||
(:eval
|
||||
(cond (buffer-read-only
|
||||
(propertize " " 'face 'mode-line-read-only-face))
|
||||
((buffer-modified-p)
|
||||
(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)
|
||||
(:propertize "%b"
|
||||
face mode-line-filename-face)
|
||||
;; 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-keyword-face)
|
||||
(propertize (substring vc 5)
|
||||
'face 'font-lock-doc-face))))
|
||||
|
||||
|
||||
" "
|
||||
(:propertize mode-name)
|
||||
; (global-mode-string global-mode-string)
|
||||
(:eval (propertize
|
||||
" " 'display
|
||||
`((space :align-to
|
||||
(- (+ right right-fringe right-margin)
|
||||
,(+ 2 (string-width "%4l:%c")))))))
|
||||
;; Line and column numbers
|
||||
(:propertize "%4l:" face mode-line-position-face)
|
||||
(:eval (propertize "%c" 'face
|
||||
(if (>= (current-column) 80)
|
||||
'mode-line-80col-face
|
||||
'mode-line-position-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)
|
||||
,(+ 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)
|
||||
'mode-line-80col-face
|
||||
'mode-line-position-face)))
|
||||
))
|
||||
|
||||
;; Helper function
|
||||
(defun shorten-directory (dir max-length)
|
||||
"Show up to `max-length' characters of a directory name `dir'."
|
||||
(let ((path (reverse (split-string (abbreviate-file-name dir) "/")))
|
||||
(output ""))
|
||||
(when (and path (equal "" (car path)))
|
||||
(setq path (cdr path)))
|
||||
(while (and path (< (length output) (- max-length 4)))
|
||||
(setq output (concat (car path) "/" output))
|
||||
(setq path (cdr path)))
|
||||
(when path
|
||||
(setq output (concat ".../" output)))
|
||||
output))
|
||||
;; Helper function
|
||||
(defun shorten-directory (dir max-length)
|
||||
"Show up to `max-length' characters of a directory name `dir'."
|
||||
(let ((path (reverse (split-string (abbreviate-file-name dir) "/")))
|
||||
(output ""))
|
||||
(when (and path (equal "" (car path)))
|
||||
(setq path (cdr path)))
|
||||
(while (and path (< (length output) (- max-length 4)))
|
||||
(setq output (concat (car path) "/" output))
|
||||
(setq path (cdr path)))
|
||||
(when path
|
||||
(setq output (concat ".../" output)))
|
||||
output))
|
||||
|
||||
;; Extra mode line faces
|
||||
(make-face 'mode-line-read-only-face)
|
||||
(make-face 'mode-line-modified-face)
|
||||
(make-face 'mode-line-folder-face)
|
||||
(make-face 'mode-line-filename-face)
|
||||
(make-face 'mode-line-position-face)
|
||||
(make-face 'mode-line-mode-face)
|
||||
(make-face 'mode-line-80col-face)
|
||||
;; Extra mode line faces
|
||||
(make-face 'mode-line-read-only-face)
|
||||
(make-face 'mode-line-modified-face)
|
||||
(make-face 'mode-line-folder-face)
|
||||
(make-face 'mode-line-filename-face)
|
||||
(make-face 'mode-line-position-face)
|
||||
(make-face 'mode-line-mode-face)
|
||||
(make-face 'mode-line-80col-face)
|
||||
|
||||
(set-face-attribute 'mode-line-read-only-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "#4271ae"
|
||||
:box '(:line-width 2 :color "#4271ae"))
|
||||
(set-face-attribute 'mode-line-modified-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "#c82829"
|
||||
:background "#ffffff"
|
||||
:box '(:line-width 2 :color "#c82829"))
|
||||
(set-face-attribute 'mode-line-folder-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "gray60")
|
||||
(set-face-attribute 'mode-line-filename-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "#eab700"
|
||||
:weight 'bold)
|
||||
(set-face-attribute 'mode-line-position-face nil
|
||||
:inherit 'mode-line-face)
|
||||
(set-face-attribute 'mode-line-mode-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "gray80")
|
||||
(set-face-attribute 'mode-line-80col-face nil
|
||||
:inherit 'mode-line-position-face
|
||||
:foreground "black" :background "#eab700")
|
||||
(set-face-attribute 'mode-line-read-only-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "#4271ae"
|
||||
:box '(:line-width 2 :color "#4271ae"))
|
||||
(set-face-attribute 'mode-line-modified-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "#c82829"
|
||||
:background "#ffffff"
|
||||
:box '(:line-width 2 :color "#c82829"))
|
||||
(set-face-attribute 'mode-line-folder-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "gray60")
|
||||
(set-face-attribute 'mode-line-filename-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "#eab700"
|
||||
:weight 'bold)
|
||||
(set-face-attribute 'mode-line-position-face nil
|
||||
:inherit 'mode-line-face)
|
||||
(set-face-attribute 'mode-line-mode-face nil
|
||||
:inherit 'mode-line-face
|
||||
:foreground "gray80")
|
||||
(set-face-attribute 'mode-line-80col-face nil
|
||||
:inherit 'mode-line-position-face
|
||||
:foreground "black" :background "#eab700")
|
||||
#+end_src
|
||||
|
||||
* Packages
|
||||
|
@ -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")
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue