logoalt Hacker News

traxler • today at 6:14 AM • 3 replies • view on HN

`Only two minimal ligatures are exposed with "->" and "=>".`

I like that, I usually have ligatures turned off, because I don't like all of them, especially the ones for == or ===. (Otoh I do like != ligatures...) but I do like the arrows.

This is probably were somebody tells me how easy it is to configure singular ligatures on a font and I'll facepalm in embarrassment for never finding out.


Replies

antiframe • today at 5:27 PM

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))
maratc • today at 7:46 AM

> I don't like all of them

I hate all of them with a passion, because they look like a glyph (i.e. "something you can erase with a single backspace") but aren't. This confuses me first, and annoys me second. "Just because we could" doesn't mean that we should.

Imagine having to use Backspace twice to erase e.g. Ö or Ñ, or being able to place your cursor halfway inside Æ.

➕ show 1 reply
sophrosyne42 • today at 6:37 AM

You can edit a font and remove the ligatures you dislike using fontforge [1].

[1] https://github.com/fontforge/fontforge