Do you find yourself constantly changing and tweaking your development editor by changing color schemes, font size, line size or tab size to improve your coding exprience?
Do you find yourself staring at a piece of code for too long just to realize you're looking at a simple lambda function with a piece of math?
Well then, you probably lack ligatures and you don't even know it! Ligatures is a font feature, that allows you to display multiple consecutive characters as one custom glyph!
If you've ever used Microsoft Word, it's substitution rules are very close to what ligatures are; with a difference, that Word really replaces the text with a substitution so original text is gone. In contrast, ligatures look like one character only when:
- you use font with ligatures
- you use editor that supports ligatures
- you have ligatures enabled
If you don't have one of these your code will look as usual; without any improvements.
Ligatures generally improve readability by making special character combinations distict and as well, making your code shorter by reducing the width of your code by displaying one shorter glyph instead of 2 or sometimes 3 regular width ones.
The funny thing is that within an editor a ligature acts as a single glyph so you can cop and paste it as a single character. In the underlying file it will, however, take space as multiple characters depending on ligature code.
- the for loop -->
- == comparison
- </ html tags
Very easy on the eyes enhanced by easily identifiable logic operators and markup formatting.
There are multiple fonts that support ligatures.
My favorite free one is Fira Code.
There are other alternatives as:
- Hasklig (free)
- Monoid (free)
- Fixedsys Excelsior (free)
- Iosevka (free)
- DejaVu Sans Code (free)
- PragmataPro (paid)
But hey, you mentioned editor support! And you're right, ligatures do not work everywhere! So here's some overview.
- VS Code (including VS Exploration)
- Microsoft Visual Studio 2015+ (including Community edition) - currently a bug in WPF prevents ligatures with minus/dash sign (like -->) to be converted
- JetBrains editors (CLion, Intellij, PHPStorm, WebStorm, PyCharm, Rider, ...)
- Notepad++ (workaround needed)
- Sublime Text
- Xamarin Studio
- Atom based editors (1.1+)
- Android Studio