summaryrefslogtreecommitdiffstats
path: root/lisp/init-mac.el
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2018-05-13 20:57:09 +0200
committerMartin Polden <mpolden@mpolden.no>2018-05-13 20:57:09 +0200
commit2e912c99b9249f1ef9c86c0cba2c2db7e17784f8 (patch)
tree818795cbe8452d9f590799c88d0eebbd79175830 /lisp/init-mac.el
parent264b7768afc6e8ddfdfdac11ba9ab6ae90b38301 (diff)
Configure ligatures
Diffstat (limited to 'lisp/init-mac.el')
-rw-r--r--lisp/init-mac.el34
1 files changed, 33 insertions, 1 deletions
diff --git a/lisp/init-mac.el b/lisp/init-mac.el
index a049edd..6108439 100644
--- a/lisp/init-mac.el
+++ b/lisp/init-mac.el
@@ -3,7 +3,39 @@
(let ((font-family "Fira Code"))
(when (and (display-graphic-p) (member font-family (font-family-list)))
(set-face-attribute 'default nil :family (concat font-family " Retina"))
- (set-face-attribute 'default nil :height 140)))
+ (set-face-attribute 'default nil :height 140)
+
+ ;; configure ligatures
+ ;; https://github.com/tonsky/FiraCode/wiki/Emacs-instructions
+ (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]))))))
;; configure modifiers
(setq mac-option-modifier 'super)