better ligatures

This commit is contained in:
Moritz Böhme 2021-04-26 11:11:34 +02:00
parent fdf51d168d
commit 07717b61e8
2 changed files with 19 additions and 33 deletions

View file

@ -54,7 +54,7 @@
;; they are implemented. ;; they are implemented.
;; Set FiraCode as Font ;; Set FiraCode as Font
(setq doom-font (font-spec :family "FiraCode Nerd Font Mono" :size 13) ) (setq doom-font (font-spec :family "FiraCode Nerd Font" :size 13) )
;; Projectile Settings ;; Projectile Settings
(setq projectile-project-root "~/Documents") (setq projectile-project-root "~/Documents")
@ -69,35 +69,19 @@
)) ))
(global-set-key (kbd "<f8>") 'fd-switch-dictionary) (global-set-key (kbd "<f8>") 'fd-switch-dictionary)
;; Enable lifatures ;; Enable the www ligature in every possible major mode
(when (window-system) (ligature-set-ligatures 't '("www"))
(set-frame-font "FiraCode Nerd Font"))
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)") ;; Enable ligatures in programming modes
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)") (ligature-set-ligatures 'prog-mode '("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\" "{-" "::"
(36 . ".\\(?:>\\)") ":::" ":=" "!!" "!=" "!==" "-}" "----" "-->" "->" "->>"
(37 . ".\\(?:\\(?:%%\\)\\|%\\)") "-<" "-<<" "-~" "#{" "#[" "##" "###" "####" "#(" "#?" "#_"
(38 . ".\\(?:\\(?:&&\\)\\|&\\)") "#_(" ".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*" "/**"
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)") "/=" "/==" "/>" "//" "///" "&&" "||" "||=" "|=" "|>" "^=" "$>"
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)") "++" "+++" "+>" "=:=" "==" "===" "==>" "=>" "=>>" "<="
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)") "=<<" "=/=" ">-" ">=" ">=>" ">>" ">>-" ">>=" ">>>" "<*"
(46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)") "<*>" "<|" "<|>" "<$" "<$>" "<!--" "<-" "<--" "<->" "<+"
(47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)") "<+>" "<=" "<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<"
(48 . ".\\(?:x[a-zA-Z]\\)") "<~" "<~~" "</" "</>" "~@" "~-" "~>" "~~" "~~>" "%%"))
(58 . ".\\(?:::\\|[:=]\\)")
(59 . ".\\(?:;;\\|;\\)") (global-ligature-mode 't)
(60 . ".\\(?:\\(?:!--\\)\\|\\(?:~~\\|->\\|\\$>\\|\\*>\\|\\+>\\|--\\|<[<=-]\\|=[<=>]\\||>\\)\\|[*$+~/<=>|-]\\)")
(61 . ".\\(?:\\(?:/=\\|:=\\|<<\\|=[=>]\\|>>\\)\\|[<=>~]\\)")
(62 . ".\\(?:\\(?:=>\\|>[=>-]\\)\\|[=>-]\\)")
(63 . ".\\(?:\\(\\?\\?\\)\\|[:=?]\\)")
(91 . ".\\(?:]\\)")
(92 . ".\\(?:\\(?:\\\\\\\\\\)\\|\\\\\\)")
(94 . ".\\(?:=\\)")
(119 . ".\\(?:ww\\)")
(123 . ".\\(?:-\\)")
(124 . ".\\(?:\\(?:|[=|]\\)\\|[=>|]\\)")
(126 . ".\\(?:~>\\|~~\\|[>=@~-]\\)")
)
))
(dolist (char-regexp alist)
(set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring]))))

View file

@ -50,3 +50,5 @@
;(unpin! t) ;(unpin! t)
(package! evil-tutor) (package! evil-tutor)
(package! ligatures
:recipe (:host github :repo "mickeynp/ligature.el"))