PHP Font Ligatures in Atom

If you’re a user of the Atom programmer’s text editor and you’ve installed a font which uses ligatures, such as the excellent Fira Code, you’ll have found that although they work fine in most languages and even with plain text files, they don’t work with PHP. Here’s a simple solution which I found here.

Open the stylesheet for editing (Atom -> Stylesheet… on MacOS, File -> Stylesheet… on Windows) and add the following, remembering to save it when you’re done:

// Enable ligatures
* {
    -webkit-font-feature-settings: "liga" on, "calt" on;
}

// Turn off ligatures inside strings and regular expessions.
atom-text-editor.editor .syntax--string .syntax--quoted,
atom-text-editor.editor .syntax--string .syntax--regexp {
    -webkit-font-feature-settings: "liga" off, "calt" off;
}

You should now find programming ligatures working in PHP.

Leave a Reply