Replace ligature.el with composition table method
This commit is contained in:
parent
480ccc268c
commit
c61ab6764b
50
init.el
50
init.el
|
@ -42,10 +42,43 @@
|
|||
tab-bar-show 1
|
||||
tab-line-tabs-function 'tab-line-tabs-mode-buffers)
|
||||
|
||||
(global-prettify-symbols-mode +1)
|
||||
(menu-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(global-prettify-symbols-mode +1)
|
||||
|
||||
;; Some witchcraft to enable ligatures, from
|
||||
;; https://github.com/tonsky/FiraCode/wiki/Emacs-instructions#using-composition-char-table
|
||||
;; Uses composition tables instead of needing an extra package
|
||||
(let ((alist '((33 . ".\\(?:\\(?:==\\|!!\\)\\|[!=]\\)")
|
||||
(35 . ".\\(?:###\\|##\\|_(\\|[#(?[_{]\\)")
|
||||
(36 . ".\\(?:>\\)")
|
||||
(37 . ".\\(?:\\(?:%%\\)\\|%\\)")
|
||||
(38 . ".\\(?:\\(?:&&\\)\\|&\\)")
|
||||
(42 . ".\\(?:\\(?:\\*\\*/\\)\\|\\(?:\\*[*/]\\)\\|[*/>]\\)")
|
||||
(43 . ".\\(?:\\(?:\\+\\+\\)\\|[+>]\\)")
|
||||
(45 . ".\\(?:\\(?:-[>-]\\|<<\\|>>\\)\\|[<>}~-]\\)")
|
||||
(46 . ".\\(?:\\(?:\\.[.<]\\)\\|[.=-]\\)")
|
||||
(47 . ".\\(?:\\(?:\\*\\*\\|//\\|==\\)\\|[*/=>]\\)")
|
||||
(48 . ".\\(?:x[a-zA-Z]\\)")
|
||||
(58 . ".\\(?:::\\|[:=]\\)")
|
||||
(59 . ".\\(?:;;\\|;\\)")
|
||||
(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]))))
|
||||
|
||||
(use-package nerd-icons
|
||||
:if (package-installed-p 'nerd-icons)
|
||||
|
@ -67,21 +100,6 @@
|
|||
:if (package-installed-p 'nerd-icons-corfu)
|
||||
:after nerd-icons)
|
||||
|
||||
(use-package ligature
|
||||
:if (package-installed-p 'ligature)
|
||||
:functions (ligature-set-ligatures
|
||||
global-ligature-mode)
|
||||
:config
|
||||
(ligature-set-ligatures
|
||||
'(prog-mode)
|
||||
'(("<" (rx (= 1 "=")))
|
||||
(">" (rx (= 1 "=")))
|
||||
("_" (rx (* "_")))
|
||||
("-" (rx (* "-") (= 1 ">")))
|
||||
("=" (rx (* "=") (? ">")))
|
||||
("!" (rx (+ "=")))))
|
||||
(global-ligature-mode +1))
|
||||
|
||||
(use-package doom-modeline
|
||||
:if (package-installed-p 'doom-modeline)
|
||||
:functions (doom-modeline-mode)
|
||||
|
|
Loading…
Reference in a new issue