123

I witnessed this in the GOTO 2016 • Kotlin - Ready for Production conference by Hadi Hariri.

In some of his code, what would normally look like:

if (x != y) { /* do some stuff */ }

Renders as:

if (x ≠ y) { /* do some stuff */ }

Screen-shot from the live coding session

The code uses the regular != operator, and the IDEA takes care of the rest.

So, how can I enable/disable this?

3
  • 27
    Came here to find how to DISABLE it :) Thanks
    – DraxDomax
    Jun 3, 2021 at 10:57
  • 3
    Who came up with this... 🤦‍♂️ Oct 23, 2022 at 22:01
  • @SergeyKolodyazhnyy I would speculate that this was a marketing move from JetBrains as they were releasing Kotlin around the same time, wanting it to look cool and modern by introducing this ligature ... :)) (I am still a big fan of JetBrains though !) Oct 23, 2022 at 23:27

5 Answers 5

155

To enable ligatures, go to the Settings → Editor → Colors & Fonts → Font, choose a font that supports ligatures, e.g. FiraCode, Hasklig, Monoid or PragmataPro (the font has to be installed) and select the Enable font ligatures option.

Source: link.

To preview some fonts, including several with ligatures: https://app.programmingfonts.org/

7
  • 34
    Now with 2018.3: File > Settings > Editor > Font > Enable font ligatures. Ensure you are using e.g. FireCode or download it here: github.com/tonsky/FiraCode/releases
    – dforce
    Aug 3, 2018 at 7:10
  • 21
    And if you want to get rid of it in Reader Mode (seems to be enabled in 2020.3 EAP by default), Editor -> Reader Mode -> Font Ligatures is the checkbox is you want to uncheck.... :) Nov 6, 2020 at 12:35
  • 3
    This doesn't disable ligatures in read-only files. Any help?
    – kajacx
    Dec 30, 2020 at 12:07
  • 5
    @kajacx: PerLundberg's comment on this answer answers that; it needs to be disabled in Reader Mode: Editor -> Reader Mode -> Font Ligatures
    – M. Justin
    Dec 30, 2020 at 19:11
  • 2
    Note that if you have a file open and @PerLundberg's solution doesn't work then you may need to close and reopen the file. That worked for me. Feb 28, 2022 at 13:58
21

This is the "font ligatures" feature, which uses ligatures to combine the characters in fonts that support them. This feature is disabled by default in the standard editor, and enabled by default in the Reader mode introduced in 2020.3.

This feature can be enabled & disabled for the current project in the project settings window (File | Settings… in Windows and Linux or IntelliJ IDEA | Preferences… in macOS).

The settings are located in the settings window at:

  • Editor: Editor | Font -> "Enable font ligatures" checkbox
  • Reader Mode: Editor | Reader Mode -> "Font ligatures" checkbox
1
  • in mine, reader mode is off, font ligatures is off - still getting the funky characters
    – Scott
    Feb 6 at 17:44
13

Goland 2020.3 (and maybe other versions too) seems to have a bug. Enabling and disabling Goland -> Preferences -> Editor -> Font -> Enable font ligatures works well on normal files but doesn't take effect on files under the vendor/ directory. These files need to be closed and reopened in the editor.

1
  • 1
    Same for PHPStorm :3
    – ssi-anik
    Feb 23, 2021 at 5:52
7

I use Material Design Theme with Android Studio 4.0, navigate to:

File->Settings->Editor->Color Scheme->Color Scheme Font

and check Enable Font Ligatures.Do the same for:

File->Settings->Editor->Color Scheme->Console Font.

This is after choosing FiraCode as your font in inteliJ. Find it here and install it as a normal font.

1
  • 2
    Use this method if you have Material Design Theme installed!
    – GHOST-34
    Feb 8, 2022 at 19:00
4

This is "font ligatures", which is a feature of certain fonts to display two characters into a single symbol (but the two characters are still there in the file). You can search the Preferences page for "ligatures" and check to enable. You'll also need to use a font that supports ligatures, such as Fira Code.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.