1
0
Fork 0

Add ligatures supported by Fantasque Sans Mono

This commit is contained in:
Tom Willemse 2021-03-16 23:31:03 -07:00
parent a3cc0b0b36
commit 59badf01c2

View file

@ -65,6 +65,24 @@ If FRAME is nil, theyre set for the current frame."
(set-fontset-font t ?✿ dejavu-sans-mono frame)
(set-fontset-font t ?✓ dejavu-sans-mono frame)))
;; Thanks to the article at
;; https://andreyorst.gitlab.io/posts/2020-07-21-programming-ligatures-in-emacs/
(defun oni-gui-setup-ligatures (&optional _)
"Define ligatures supported by Fantasque Sans Mono."
(let ((ligatures
`((?= . ,(regexp-opt '("==" "===" "=/=" "=>" "==>" "=>>" "=<<")))
(?! . ,(regexp-opt '("!=" "!==")))
(?< . ,(regexp-opt '("<-<" "<<-" "<--" "<-" "<->" "<=<" "<<=" "<=="
"<=>" "<~>" "<~~" "<~" "<<<" "<<" "<=" "<>"
"<|||" "<||" "<|" "<|>" "<!--")))
(?- . ,(regexp-opt '("->" "-->" "->>" "-<" "-<<")))
(?> . ,(regexp-opt '(">->" ">=>" ">>=" ">>-" ">-" ">=" ">>" ">>>")))
(?~ . ,(regexp-opt '("~~" "~>" "~~>")))
(?| . ,(regexp-opt '("|>" "||>" "|||>"))))))
(dolist (char-regexp ligatures)
(set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring])))))
(with-eval-after-load 'isearch
(diminish 'isearch-mode (string ?\s oni-gui-isearch-icon)))
(with-eval-after-load 'autorevert
@ -90,8 +108,11 @@ _bi_: Auto Insert ^^ ^^
(mode-icons-mode)
(if (daemonp)
(progn
(add-hook 'after-make-frame-functions #'oni-gui-setup-fontsets)
(oni-gui-setup-fontsets nil))
(add-hook 'after-make-frame-functions #'oni-gui-setup-ligatures))
(oni-gui-setup-fontsets nil)
(oni-gui-setup-ligatures))
(global-unset-key (kbd "C-z"))
(global-set-key (kbd "C-c c") 'oni-gui-hydra/body)