Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using Operator Mono with Fira Code ligatures in Atom.

Using Operator Mono with Fira Code ligatures in Atom.

  1. Open your Atom's Stylesheet
    image

  2. Put this css

atom-text-editor {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  font-family: "Operator Mono";
  font-weight: 500;
  line-height: 1.7;
}

For Atom version < 1.13.x

atom-text-editor::shadow {
  .storage.type.function.arrow,
  .keyword.operator:not(.accessor),
  .punctuation.definition.entity.css {
    font-family: 'Fira Code';
  }

  .string.quoted,
  .string.regexp {
    -webkit-font-feature-settings: "liga" off, "calt" off;
  }
}

For Atom version >= 1.13.x

atom-text-editor.editor {
  .syntax--storage.syntax--type.syntax--function.syntax--arrow,
  .syntax--keyword.syntax--operator:not(.accessor),
  .syntax--punctuation.syntax--definition {
    font-family: "Fira Code";
  }

  .syntax--string.syntax--quoted,
  .syntax--string.syntax--regexp {
    -webkit-font-feature-settings: "liga" off, "calt" off;
  }
}

Save file and it's done.


Works fine with Javascript:

image

@tdeekens
Copy link

tdeekens commented Jul 22, 2017

Hasklig also works nice with this. Thanks!

@kiliman
Copy link

kiliman commented Aug 14, 2017

I created a project that will add ligatures directly to the Operator Mono font. https://github.com/kiliman/operator-mono-lig

@helton
Copy link

helton commented Sep 1, 2017

Nice work @renatorib!

I had some problems with the round and curly brackets (the CSS selector .syntax--punctuation.syntax--definition was matching more than it was necessary).
I also applied italic to some tokens (like import, export, from, class, return and so on).
It works with the syntax JavaScript (JSX) available in the React atom package.

My styles.less file now looks like this:

https://gist.github.com/helton/24b652bda30dcaa83660cfacb75a2797

@renatorib
Copy link
Author

renatorib commented Sep 11, 2017

Note

I don't use Atom anymore - I migrated to vscode
Because of that I will not know or be able to fix bugs or maintain future breaking changes versions of Atom.

But if anyone wants to help, comment here what/why/how to fix then I edit this gist.
Thanks!

@renatorib
Copy link
Author

renatorib commented Sep 11, 2017

Great project @kiliman!

@orenmizr
Copy link

orenmizr commented Oct 25, 2017

how to you achieve the same in vscode ? @renatorib

@chrishiste
Copy link

chrishiste commented Nov 21, 2017

Could you tell us how you do that on vscode please @renatorib @orenmizr

@Maartz
Copy link

Maartz commented Dec 7, 2017

Hi guys,

@orenmizr @chrishiste

I switched from VSCode to Atom recently and the tweak for having ligatures of Fira Code and Operator Mono for fonts is the following.
First download this package https://github.com/be5invis/vscode-custom-css

Then you create a basic css file somewhere on your computer, copy paste this snippet

.mtk5, .mtk8, .mtki, .mtk10 {
  font-family: 'Operator Mono';
  font-size: 16px;
  font-weight: normal;
  font-style: italic;
}

Then you'll have to go into VSCode settings panel and point to the newly created CSS file.
After that, open the command palette and just activate vscode-custom-css.

This should be the best way to do it.

WARN : Maybe Code will tell you that your Code version is broken, just don't care, it's because of vscode-custom package.

@phavor
Copy link

phavor commented Sep 14, 2018

You are my hero. I hadn't even thought to do this. I use Operator Mono, and sorely miss my ligatures from Fira Code. Thank you so much! I already have a lot of tweaks in my CSS to user OM's script italics for more than just comments. Perfect addition.

screen shot 2017-01-11 at 11 07 59 pm

How did you tweak yours please.?

@ikluhsman
Copy link

ikluhsman commented Jan 20, 2019

@phavor
Open Atom's stylesheet in Atom > Stylesheet..

Modify the sections to look like the following, the spans are the important part. You can find these class names by browsing through the editor in syntax of your choice using the developer tools (Option+Cmd+I).

`atom-text-editor.editor {

.syntax--storage.syntax--type.syntax--function.syntax--arrow,
.syntax--keyword.syntax--operator:not(.accessor),
.syntax--keyword.syntax--type,
.syntax--punctuation.syntax--definition {
font-family: "Fira Code";
}

span.syntax--keyword.syntax--control,
span.syntax--storage.syntax--type,
span.syntax--storage.syntax--modifier {
font-family: "Operator Mono";
font-style: italic;
}
`

@cedrus-8864
Copy link

cedrus-8864 commented Mar 11, 2019

You are my hero. I hadn't even thought to do this. I use Operator Mono, and sorely miss my ligatures from Fira Code. Thank you so much! I already have a lot of tweaks in my CSS to user OM's script italics for more than just comments. Perfect addition.

screen shot 2017-01-11 at 11 07 59 pm

What syntax theme and TextMate rules are you using? It's look nice. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment