1
1
mirror of https://github.com/tonsky/FiraCode.git synced 2024-07-04 16:06:26 +03:00

Added a section for ligature.el as a way to enable ligatures in emacs

MyriaCore 2020-09-28 13:42:11 -04:00
parent 711cf4b534
commit 425a900a5e

@ -8,6 +8,7 @@ There are a few options when it comes down to using ligatures in
Emacs. They are listed in order of preferred to less-preferred. Pick one!
- [Using composition mode in Emacs Mac port](#using-composition-mode-in-emacs-mac-port)
- [ligature.el](#ligature.el)
- [Using prettify-symbols](#using-prettify-symbols)
- [Using composition char table](#using-composition-char-table)
- [Using font-lock keywords](#using-font-lock-keywords)
@ -21,6 +22,29 @@ of Emacs (by Mitsuharu Yamamoto) for macOS, you can use:
(mac-auto-operator-composition-mode)
```
### ligature.el
If you're using a modern version of emacs, you might have ligature support built-in, via HARFBUZZ / Cairo. The [ligature.el](https://github.com/mickeynp/ligature.el) package adds infrastructure that uses Harfbuzz and Cairo to render ligatures from the fonts, just like in any other editor. Add the following to your `init.el` file:
```elisp
;; Enable the www ligature in every possible major mode
(ligature-set-ligatures 't '("www"))
;; Enable ligatures in programming modes
(ligature-set-ligatures 'prog-mode '("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\" "{-" "::"
":::" ":=" "!!" "!=" "!==" "-}" "----" "-->" "->" "->>"
"-<" "-<<" "-~" "#{" "#[" "##" "###" "####" "#(" "#?" "#_"
"#_(" ".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*" "/**"
"/=" "/==" "/>" "//" "///" "&&" "||" "||=" "|=" "|>" "^=" "$>"
"++" "+++" "+>" "=:=" "==" "===" "==>" "=>" "=>>" "<="
"=<<" "=/=" ">-" ">=" ">=>" ">>" ">>-" ">>=" ">>>" "<*"
"<*>" "<|" "<|>" "<$" "<$>" "<!--" "<-" "<--" "<->" "<+"
"<+>" "<=" "<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<"
"<~" "<~~" "</" "</>" "~@" "~-" "~>" "~~" "~~>" "%%"))
(global-ligature-mode 't)
```
This is generally the easiest solution, but can only be used on macOS.
### Using prettify-symbols