Skip to content

Instantly share code, notes, and snippets.

@plaidfinch
Last active July 15, 2021 01:56
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save plaidfinch/dea7bc51101083acb95c875140e2a96d to your computer and use it in GitHub Desktop.
Save plaidfinch/dea7bc51101083acb95c875140e2a96d 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.
;; 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)
@barrosfelipe
Copy link

Do you mind sharing how you find the correct glyph character to use it in this code? I would like to build a similar map for other fonts that support ligature. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment