Set ligatures more generally

This commit is contained in:
Tobias Ostner 2024-06-29 11:56:25 +02:00
parent b48675956b
commit 58f2110aa5

View file

@ -347,15 +347,29 @@
(use-package ligature
:after fontaine
:config
(defun to/set-ligatures-for-font-iosevka ()
(when (string= "Iosevka Comfy" (face-attribute 'default :family))
(ligature-set-ligatures
'prog-mode '("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "<!--"
"<==" "<===" "<=" "=>" "=>>" "==>" "===>" ">=" "<=>" "<==>" "<===>" "<====>" "<!---"
"<~~" "<~" "~>" "~~>" "::" ":::" "==" "!=" "===" "!=="
":=" ":-" ":+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++"))))
(defun to/set-ligatures-for-font (font-family)
(let ((ligatures
(cond ((string= font-family "Iosevka Comfy")
'("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->"
"<---->" "<!--" "<==" "<===" "<=" "=>" "=>>" "==>" "===>" ">="
"<=>" "<==>" "<===>" "<====>" "<!---" "<~~" "<~" "~>" "~~>" "::"
":::" "==" "!=" "===" "!==" ":=" ":-" ":+" "<*" "<*>" "*>" "<|"
"<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++"))
((string= font-family "Cascadia Code")
'("www" "--" "---" "-~" "(*" "{|" "}#" "[|" "]#" ".-" ".." "..." "..="
"..<" ".?" ".=" "::" ":::" "::=" ":=" "://" ";;" "!." "!:" "!!" "!!."
"!=" "!==" "?." "?:" "??" "??=" "?=" "*)" "**" "***" "*>" "*/" "#("
"#{" "#[" "#:" "#!" "#?" "#=" "#_" "#_(" "/*" "/>" "//" "///" "/\\"
"\\\\" "&&" "|}" "|]" "||" "|||" "|||>" "|>" "$>" "++" "+++" "+>" "=="
"===" "=>>" "=<<" ">=" ">>" ">>=" ">>>" "<!--" "<*" "<*>" "<|" "<||"
"<|||" "<|>" "<$" "<$>" "<+" "<+>" "<=" "<>" "<<" "<<=" "<<<" "<~"
"<~>" "<~~" "</" "</>" "~-" "~@" "~=" "~>" "~~" "~~>" "^=" "%%"))
(t
'()))))
(when (string= font-family (face-attribute 'default :family))
(ligature-set-ligatures 'prog-mode ligatures))))
(to/set-ligatures-for-font-iosevka)
(to/set-ligatures-for-font (face-attribute 'default :family))
(global-ligature-mode t))
(use-package magit
@ -363,7 +377,7 @@
(use-package magit-todos
:after magit
:config
:configp
(magit-todos-mode 1))
(use-package marginalia