emacs: Set font to Monaspace

This commit is contained in:
Erwin Boskma 2023-11-10 16:45:56 +01:00
parent c3c2aa518d
commit 95f5f73b6f
Signed by: erwin
SSH key fingerprint: SHA256:3F6Cm6I3erRqlBwEghZWAQl6eS5WrGTX1Vs/Evec1lQ

View file

@ -55,8 +55,9 @@ Setting =lexical-binding= to =t= can improve startup time. This has to be first!
This sets some variables with my personal preferences for easy customization This sets some variables with my personal preferences for easy customization
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar my/default-font "Iosevka Nerd Font") (defvar my/default-font "Monaspace Argon-16")
(defvar my/variable-width-font "Iosevka Aile") (defvar my/variable-width-font "Iosevka Aile-16")
(defvar my/comment-font "Monaspace Radon-16")
(defvar my/default-font-height 13) (defvar my/default-font-height 13)
(defvar my/default-font-weight 'normal) (defvar my/default-font-weight 'normal)
(defvar my/default-font-width 'normal) (defvar my/default-font-width 'normal)
@ -101,7 +102,7 @@ LSP responses can be rather large, in the 800KiB - 3MiB range. 2MiB is a decent
** Package sources ** Package sources
Add repositories where packages are installed from. Add repositories where packages are installed from.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
@ -419,22 +420,19 @@ I prefer the [[https://draculatheme.com][dracula theme]]
(load-theme 'monokai-pro t)) (load-theme 'monokai-pro t))
#+end_src #+end_src
Use Iosevka as font. Set fonts.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-to-list 'default-frame-alist `(font . ,(format "%s-%d:weight=%s:width=%s" (defun my/setup-fonts ()
my/default-font ; Monospace
my/default-font-height (set-face-attribute 'default nil :font my/default-font)
my/default-font-weight (set-face-attribute 'font-lock-comment-face nil :font my/comment-font)
my/default-font-width))) ; Variable pitch
#+end_src (set-face-attribute 'variable-pitch nil
:font my/variable-width-font
#+begin_src emacs-lisp :height my/variable-width-font-height))
(set-face-attribute 'variable-pitch nil (add-hook 'after-init-hook 'my/setup-fonts)
:family my/variable-width-font (add-hook 'server-after-make-frame-hook 'my/setup-fonts)
:weight my/default-font-weight
:width my/default-font-width
:height my/variable-width-font-height)
#+end_src #+end_src
Emoji support Emoji support
@ -459,10 +457,30 @@ Enable ligatures
(use-package ligature (use-package ligature
:config :config
;; Enable all Iosevka ligatures in programming modes ;; Enable all Iosevka ligatures in programming modes
(ligature-set-ligatures 'prog-mode '("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "<!--" ;; (ligature-set-ligatures 'prog-mode '("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "<!--"
"<==" "<===" "<=" "=>" "=>>" "==>" "===>" ">=" "<=>" "<==>" "<===>" "<====>" "<!---" ;; "<==" "<===" "<=" "=>" "=>>" "==>" "===>" ">=" "<=>" "<==>" "<===>" "<====>" "<!---"
"<~~" "<~" "~>" "~~>" "::" ":::" "==" "!=" "===" "!==" ;; "<~~" "<~" "~>" "~~>" "::" ":::" "==" "!=" "===" "!=="
":=" ":-" ":+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++")) ;; ":=" ":-" ":+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++"))
;; Ligatures for Monaspace
(ligature-set-ligatures 'prog-mode '(
; ss01
"==" "===" "=/=" "!=" "!==" "/=" "/==" "~~" "=~" "!~"
; ss02
">=" "<="
; ss03
"->" "<-" "=>" "<!--" "-->" "<~" "<~~" "~>" "~~>" "<~>"
; ss04
"</" "/>" "</>" "/\\" "\\/"
; ss05
"|>" "<|"
; ss06
"##" "###"
; ss07
"***" "/*" "*/" "/*/" "(*" "*)" "(*)"
; ss08
".=" ".-" "..<"
; dlig & calt
"<!" "**" "::" "=:" "=!" "=/" "--" ".." "//" "&&" "||" ":=" ":>" ":<" "!!" ">:" "<:" "#=" "?:" "?." "??" ";;" "///" ":::" "..." "=!=" "=:=" "..=" "..-"))
;; Enables ligature checks globally in all buffers. You can also do it ;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'. ;; per mode with `ligature-mode'.
(global-ligature-mode t)) (global-ligature-mode t))