-
-
Save zenlor/38d21eabfddd1c5fb8606bdafed66cb2 to your computer and use it in GitHub Desktop.
Mappings for prettify-symbols-mode to enable Pragmata Pro's ligatures in Emacs. I've taken some slight liberties with the original ligature map, to suit my own tastes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; PRETTIFY SYMBOLS (with Pragmata Pro) | |
(defun setup-pragmata-ligatures () | |
(setq prettify-symbols-alist | |
(append prettify-symbols-alist | |
'(("!!" . ?) | |
("!=" . ?) | |
("!==" . ?) | |
("!≡" . ?) | |
("!≡≡" . ?) | |
("!>" . ?) | |
("#(" . ?) | |
("#_" . ?) | |
("#{" . ?) | |
("#?" . ?) | |
("#>" . ?) | |
("%=" . ?) | |
("%>" . ?) | |
("<~" . ?) | |
("&%" . ?) | |
("&&" . ?) | |
("&*" . ?) | |
("&+" . ?) | |
("&-" . ?) | |
("&/" . ?) | |
("&=" . ?) | |
("&&&" . ?) | |
("&>" . ?) | |
("$>" . ?) | |
("~>" . ?) | |
;; ("***" . ?) ; I prefer not to use this one | |
("*=" . ?) | |
("*/" . ?) | |
("*>" . ?) | |
("++" . ?) | |
("+++" . ?) | |
("+=" . ?) | |
("+>" . ?) | |
("--" . ?) | |
("-<" . ?) | |
("-<<" . ?) | |
("-=" . ?) | |
("->>" . ?) | |
("---" . ?) | |
("-->" . ?) | |
(".." . ?) | |
("..." . ?) | |
("..<" . ?) | |
(".>" . ?) | |
(".~" . ?) | |
(".=" . ?) | |
("/*" . ?) | |
("//" . ?) | |
("/>" . ?) | |
("/=" . ?) | |
("/==" . ?) | |
("///" . ?) | |
("/**" . ?) | |
("::" . ?) | |
(":=" . ?) | |
(":≡" . ?) | |
(":>" . ?) | |
(":=>" . ?) | |
("<$>" . ?) | |
("<*" . ?) | |
("<*>" . ?) | |
("<+>" . ?) | |
;; ("<-" . ?) ; I like different arrows (see below) | |
("<<" . ?) | |
("<<<" . ?) | |
("<<=" . ?) | |
("<=" . ?) | |
;; ("<=>" . ?) ; I like different arrows (see below) | |
("<>" . ?) | |
("<|>" . ?) | |
("<<-" . ?) | |
("<|" . ?) | |
("<=<" . ?) | |
("<~~" . ?) | |
("<<~" . ?) | |
("<$" . ?) | |
("<+" . ?) | |
("<!>" . ?) | |
("<@>" . ?) | |
("<#>" . ?) | |
("<%>" . ?) | |
("<^>" . ?) | |
("<&>" . ?) | |
("<?>" . ?) | |
("<.>" . ?) | |
("</>" . ?) | |
("<\>" . ?) | |
("<\">" . ?) | |
("<:>" . ?) | |
("<~>" . ?) | |
("<**>" . ?) | |
("<<^" . ?) | |
("<!" . ?) | |
("<@" . ?) | |
("<#" . ?) | |
("<%" . ?) | |
("<^" . ?) | |
("<&" . ?) | |
("<?" . ?) | |
("<." . ?) | |
("</" . ?) | |
("<\\" . ?) | |
("<\"" . ?) | |
("<:" . ?) | |
("<->" . ?) | |
("<!--" . ?) | |
("<--" . ?) | |
("=<<" . ?) | |
("==" . ?) | |
("===" . ?) | |
;; ("==>" . ?) ; I like different arrows (see below) | |
;; ("=>" . ?) ; I like different arrows (see below) | |
("=~" . ?) | |
("=>>" . ?) | |
("≡≡" . ?) | |
("≡≡≡" . ?) | |
("≡:≡" . ?) | |
(">-" . ?) | |
(">=" . ?) | |
(">>" . ?) | |
(">>-" . ?) | |
(">>=" . ?) | |
(">>>" . ?) | |
(">=>" . ?) | |
(">>^" . ?) | |
("??" . ?) | |
("?~" . ?) | |
("?=" . ?) | |
("?>" . ?) | |
("^=" . ?) | |
("^." . ?) | |
("^?" . ?) | |
("^.." . ?) | |
("^<<" . ?) | |
("^>>" . ?) | |
("^>" . ?) | |
("\\\\" . ?) | |
("\\>" . ?) | |
("@>" . ?) | |
("|=" . ?) | |
("||" . ?) | |
("|>" . ?) | |
("|||" . ?) | |
("|+|" . ?) | |
("~=" . ?) | |
("~~>" . ?) | |
("~>>" . ?) | |
;; Personal preference: I like this set of arrows better than default | |
("<-" . ?🡐) | |
("->" . ?🡒) | |
("=>" . ?⇒) | |
("<=>" . ?⟺) | |
("<==>" . ?⟺) | |
("==>" . ?⟹) | |
("<==" . ?⟸) | |
("|->" . ?⟼) | |
("<-|" . ?⟻) | |
("|=>" . ?⟾) | |
("<=|" . ?⟽) | |
)))) | |
(defun refresh-pretty () | |
(prettify-symbols-mode -1) | |
(prettify-symbols-mode +1)) | |
;; Hooks for modes in which to install the Pragmata ligatures | |
(mapc (lambda (hook) | |
(add-hook hook (lambda () (setup-pragmata-ligatures) (refresh-pretty)))) | |
'(text-mode-hook | |
prog-mode-hook)) | |
(global-prettify-symbols-mode +1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment