logoalt Hacker News

antiframe • today at 5:27 PM • 0 replies • view on HN

It's pretty easy. You can opt into any ligature you like across every mode, and then add extra ones for each programming mode or other mode. For example:

  (use-package ligature
    :ensure t
    :config
    ;; Enable specific ligatures globally across all modes:
    (ligature-set-ligatures 't '("==" "===" "!=" "->" "-->" "=>" "=="))
  
    ;; Enable individual ligatures only for specific programming modes:
    (ligature-set-ligatures '(python-mode rust-mode c-mode)
                            '("||" "&&" "::" "->" "=>" "!="))

    ;; Enable ligatures only for HTML / XML:
    (ligature-set-ligatures '(html-mode nxml-mode web-mode)
                            '("<!--" "-->" "</" "/>"))

    ;; Enable global ligature mode
    (global-ligature-mode t))