Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2017/07/26

Using VS Code and Ligatures

Quick history: I started out as a vi man, having the comical "how do I save and exit?" issues with emacs that I see lots of people complain about for vim. After college, my first job's standard editor was UltraEdit. In the lab, I experimented with KomodoEdit, have been a Sublime Text 2 user, and right now, on both Windows and Linux, I'm using Visual Studio Code.

As well as vim. There are occasional things VS Code can't do, or at least can't do with the packages I know about. Line sorting, for one. I like to have my modules sorted; it helps me to see if the one I want is called.

Similarly, over time, I have developed a fondness for specific fonts in my editor. I cannot go through a long history of preference, but I can say that variations of Droid Sans Mono with modifications for a dotted or slashed zero do more easily distinguish them from capital O are normally what I run in terminals and editors.

But, I recently saw Scott Hanselman blog on Monospace Programming Fonts with Ligatures.

What's that?

Consider the code from yesterday's post on Sentiment Analysis. There are a couple places where there are skinny arrows (->), fat arrows (=>) and greater-than-and-equal signs (>=). Look specifically at line 21 for skinny arrows and greater-and-equal. Pretty, isn't it? I will also point out that line 21 also shows the dotted 0 and how easy it is to distinguish it from letters.

Also look at the logical AND (&&) on like 36.


These are just in-the-editor changes; the code from yesterday's post is copied from this editor.

The font I'm using is called Fira Code, and it's on GitHub. There are others, like Monoid and Hasklig that can do this, but I like Fira Code. Within VS Code, you also have to add "editor.fontLigatures": true to your settings.

I have it as my font for the HexChat IRC client, which supports ligatures, and Git for Windows Bash, Windows Subsystem for Linux and PowerShell terms on Windows, which don't, but the font still looks good. I noticed an issue where it swallowed the equal sign in Gnome Terminal, so there I'm back to Droid Sans Mono Slashed, but that might have been a temporary issue.

Hrmm. Yesterday, I wrote on an Azure API. Today, I'm praising a Visual Studio-related editor. Tomorrow, I might get into the Windows Subsystem for Linux.

No comments:

Post a Comment