Add ligatures supported by Fantasque Sans Mono
This commit is contained in:
parent
a3cc0b0b36
commit
59badf01c2
1 changed files with 23 additions and 2 deletions
25
oni-gui.el
25
oni-gui.el
|
@ -65,6 +65,24 @@ If FRAME is nil, they’re set for the current frame."
|
||||||
(set-fontset-font t ?✿ dejavu-sans-mono frame)
|
(set-fontset-font t ?✿ dejavu-sans-mono 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
|
(with-eval-after-load 'isearch
|
||||||
(diminish 'isearch-mode (string ?\s oni-gui-isearch-icon)))
|
(diminish 'isearch-mode (string ?\s oni-gui-isearch-icon)))
|
||||||
(with-eval-after-load 'autorevert
|
(with-eval-after-load 'autorevert
|
||||||
|
@ -90,8 +108,11 @@ _bi_: Auto Insert ^^ ^^
|
||||||
(mode-icons-mode)
|
(mode-icons-mode)
|
||||||
|
|
||||||
(if (daemonp)
|
(if (daemonp)
|
||||||
(add-hook 'after-make-frame-functions #'oni-gui-setup-fontsets)
|
(progn
|
||||||
(oni-gui-setup-fontsets nil))
|
(add-hook 'after-make-frame-functions #'oni-gui-setup-fontsets)
|
||||||
|
(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-unset-key (kbd "C-z"))
|
||||||
(global-set-key (kbd "C-c c") 'oni-gui-hydra/body)
|
(global-set-key (kbd "C-c c") 'oni-gui-hydra/body)
|
||||||
|
|
Loading…
Reference in a new issue