Hacker News new | past | comments | ask | show | jobs | submit login
Sublime Text 3 now has font ligature support (sublimetext.com)
267 points by indentit on Oct 6, 2017 | hide | past | favorite | 111 comments

Honest question: Why would you want ligatures in plaintext? Especially in code, wouldn't that be weird as some people tend to manually align their code? Like,

  modular_raft = 10
  spam         = 20
The "ft" in modular_raft should convert to a ligature so (I assume) it will then take one character, instead of two. Then developers viewing that source would have different alignments, depending on whether they use Sublime 3 or not.

(EDIT: Formatting.)

Besides fancy programming fonts (which I have mixed feelings about), ligatures and other complex text shaping features can also be necessary for legibly rendering string literals in some non-Latin scripts, like Arabic script. Even if your code is all in Latin letters, you might have test data, UI text, etc., that's in something else.

Thank you for providing this insight -- I'm one of the seemingly rare few who hates ligatures in my Latin-script fonts, and when I saw this submission my brain leapt to "augh, why!?" -- you've given at least one very clear use-case where ligature support is valuable, which I was totally unaware of.

The cool thing about ligatures is that they are a property of the font, not of the text, so I can have a font with ligatures and you can have one without.

I've been using Fira Code for a while and having ligatures does make code a bit easier for me to read. I certainly could live without the feature, but if it's there, I'm going to turn it on.

Which, ultimately, is what matters. You actually have to turn it on in Jetbrain's editors.

It's a decent "no harm, no foul" feature.

I tried to get ligatures to work in gvim for so long because Fira Code looks wonderful with ligatures. Could not make it work :(

This was the most recent blurb on HN I've seen about fonts with ligatures for coding:


I've mixed feelings about the idea, but generally seem to like the combination of Atom and Fira Code.

Perhaps the editor should include a method to turn this kind of options on/off with special sequences e.g. in comments.

That, or just don't apply ligatures to basic Latin characters. I suppose that people who like using international characters for their identifiers would not mind having ligatures applied to them. Solved by font selection.

Are you saying this version of SL supports rendering Arabic with proper shaping?

Since it now uses DirectWrite, it should support Arabic well, at least on Windows. DirectWrite handles shaping for a bunch of scripts.

Some people use monospace fonts with ligatures specific to common programming languages: https://github.com/tonsky/FiraCode is one such example.

Nice example, thank you. I see how they managed to avoid my issues.

(To save people the click: LaTeX ligatures != Fira ligatures. Most Fira ligatures are for programming operators/comparators and they are made to take as much space as the non-ligature version.)

Both of these ligatures (fi and ->) in standard computer fonts like TTF or OTF use exactly the same technology.

The only difference is that one ligature applies to alphabetic characters and the other to non-alphabetic characters.

Ligatures can be used to make some font aesthetically pleasing like this: http://www.impallari.com/lobster/

Or they can be abused like this: https://pixelambacht.nl/2015/sans-bullshit-sans/

It is perfectly possible for a font to have alphabetic and non-alphabetic ligatures.

I've been using FiraCode in Idea with ligatures, and like it.

It's not a "must have", but I find it more readable and pleasing than using regular fonts.

The monospace font ligatures turn 2 characters into a double-wide single character, so you can still align to your heart's content! https://www.hanselman.com/blog/MonospacedProgrammingFontsWit...

I can only speak for me as someone who really loves the aesthetics of code, but there's something super enjoyable about things like arrow functions rendering as actual arrows in Java / JavaScript. It's so clean!

Yeah, only that it does that without any context.

Ligature mishaps are doubleplus-unclean.

Not all ligatures work for all syntax files. Therefore the syntax file has something to do with ligatures, therefore it has context.

I agree, for this reason I don't think it is right to do on a font level. I prefer to use my editor's (emacs) capability to do visual substitutions depending on language that I am using.

This reminds me of elastic tabstops. https://en.wikipedia.org/wiki/Tab_stop#Elastic_tabstops

Does Sublime Text support those? Any other popular editor? If not, why?

No decent editor or IDE supports "proper" elastic tabstops, except for a Visual Studio plugin, I believe.

The problem is that it needs the underlying text editor to support different non-uniform tab stops to be configured for every line of code. Few if any text editors support it.

>The "ft" in modular_raft should convert to a ligature so (I assume) it will then take one character, instead of two

It's not about those kind of ligatures -- but about special programming fonts with programming-oriented ligatures (think >= etc).

Those still can affect code alignment, but there are people who are against manual alignment anyway.

It doesn't affect formatting spacing and is mostly for special symbols like arrows, greater than equal, double and triple equalities, etc. The ligatures in question are for programming languages, not stuff like 'ft'.

This is my understanding of it as well. The purpose is to DISPLAY two characters as one more clearer to view character, but on GitHub and other places it will still be two independent characters. The purpose is clarity whilst viewing code.

Even if monospaced fonts have that ligature, I'm sure they make it as wide as two characters, as the ligature is simply a single glyph representing two characters.

> it will then take one character, instead of two

No it will still take two characters, but they will be represented by a single glyph.

Just because it's "plain text" doesn't mean it has to be monospaced. There are too many other things you can write that aren't "code" for which a good text editor is infinitely preferable to a clunky dedicated GUI application.

Yes!!!!!!!!!!!!!! I nearly quit sublime after using an editor that supported this feature for a month. While sublime is vastly superior in my mind to most other editors (spacemacs and Vim in my book not withstanding) I make a lot of use of icons in the Nerd Fonts for custom icons so this is a huge plus for me.

In my haste: forgot to link to the nerd fonts page! https://github.com/ryanoasis/nerd-fonts

For what it’s worth, I may be a tad OCD about how my desktop looks and feels :P

Could you expand on what exactly you use Nerd Fonts for?

I downloaded a few fonts and was expecting using an icon code + a ligature supporting editor to result in the icon magically appearing in my editor but that does not seem to be the case.

I extract the icons and make my own folders and theme stuffs. It unfortunately only magically works in Vim with nerdtree or in SpaceMacs with their tree plugin. However I enjoy making my own folders and icons so I don’t mind. I should really publish this, there may be a hidden demand here I was unaware of

Which other editor did you use for a month?

I used VS Code with ligature support. It was nice looking with a good theme. I also really enjoy Vim and the nerdtree functionality

I love the idea of ligatures, but I don't find Fira Code very comfortable. Any other recommendations?

EDIT: Some fonts I like are Courier New and Droid Sans Mono.

If you like Operator Mono, I created a project that will add ligatures to the font.


Awesome, was just looking for something like that!

Now that sublime supports it, is there a way to use this font with it?

I've been using Hasklig lately. Given your preferences, you might be interested in Monoid.

Try Hack; I’ve been using it for a while and I really dig it!


Does it support ligatures?

A google search implies that it does not and I just tried some PHP code on it to confirm that it doesn't as well.

Iosevka is a nice one

Iosevka is way too thin for me. I'm going to try out Hasklig (moving from Ubuntu Mono)

I've spent the last six months trying out new fonts (m0n0, hack, monoid, hasklig, fira code, mononoki, fixedsys excelsior, iosevka, source code pro, input...)

Nothing cuts it, there's always that tiny thing that bothers me, and I'm back with Ubuntu Mono.

Yeah it's great isn't it? I've tried heaps of times over the last few years to switch and haven't found a font I like better than Ubuntu Mono.

OT question: a lot of fonts come in all possible formats. If I am just installing them on my macOS box, does it matter which format I install? Is there a reason to prefer say .woff2 over .ttf? Or are they functionally equivalent?

woff and woff2 are web font standards. I don't think they're supported by most operating systems.

Well fair enough, but what about TTF vs OTF?

OpenType (otf) is more modern than TrueType (ttf) and supports more functionality and features within the font.

So if installing a font locally, OTF is the way to go if it's available?


How long did you try it? I found I had the identical reaction to you -- that it was way too narrow, being used to much wider monospace fonts. It took me about a day to get used to it, and now I love it to death.

It's probably not the font for everyone, but I mention this because I had the same initial reaction as you, and I'm super glad I gave it a serious try.

Iosevka has many weights and is customizable though. Or you mean narrow?

Pragmata Pro?

It seems to work but it does render certain ligatures incorrectly on OS X for me. For example, <* is rendered as the <> ligature and <- is rendered as </. Since it's a dev build, I'm sure it will take some ironing out before it hits the stable version but this is really promising!

You should report this in the Sublime forum thread. Especially important to do it right now, because jps is most responsive initially after a release.

I believe this has now been fixed, although I've noticed a few other issues but the forum is down.

I can verify that the issue I saw has been fixed. Now that's the kind of turn around time that I like to see!

Could it be that the syntax highlighter is splitting up < and * as separate tokens?

I tested using plain text mode for this reason. Definitely a gotcha in other editors which support this too.

Tangent: Any good resources to read up on typography? I feel like of all design related issues thats the one I have zero knowledge or insight on.

Josef Muller-Brockmann's books are a decent primer on the basics of graphic design (including typography). They are old but the information in them is not necessarily out of date, and the writing style is very helpful since he includes examples and explanations of how to apply the concepts practically.

If you are going to read them I would recommend "Grid Systems in Graphic Design" and "The Graphic Artist and His Design Problems". "History of the Poster" is worth getting too. Make sure to get them as books, not PDFs. His lessons about margins and font size make a lot more sense when you are viewing them in the book laid out according to his own principles.

/edit The Vignelli Canon is a nice read too. See: http://www.vignelli.com/canon.pdf

I learned a lot from "The Elements of Typographic Style" by Robert Bringhurst. I sometimes find it a bit hard to read casually, but there's a lot in there I enjoy absorbing.


My friend teaches typography at an fine arts and design school and "Elements" is the textbook. When I went to art school in the 90s it was also one of my textbooks (though it was still a relatively new book at the time). It's one of the few books that's remained on my shelf for the 20ish years since I bought it. I still reference it regularly.

I find it a nice-looking book too, which is unsurprisingly expected for its nature.

I enjoyed this one: https://practicaltypography.com/

Great link. Just finished reading through it and I feel more educated on typography. At the very least I now have a better feel of the lingo and vocabulary which surrounds typography. Thanks.

I highly recommend this one. It is divided in short sections devoted to one specific topic, directly to the point, including practical examples and indicating how to do it in popular software like Word, CSS, etc.

I would highly recommend James Felici's The Complete Manual of Typography. Goes through all the core concepts of typography and why they matter, and provides a number of guidelines.


Now if only the TypeScript plugin were more reliable. Ligatures and TS support were the things making me consider switching. The TS plugin for Sublime is disappointingly buggy.

I've been using Language Server to learn rust while coming back to ST after using VSCode extensively. Have you tried using a LSP extension instead of a TypeScript one?

No, but maybe I should. Thanks for the tip!

One of the things I hate about the native TS extension is that it disables tab-completion in TS files. I wonder if LSP fixes that.

Can i use operator mono with Fira code ligature?

From what I know, you could patch your `Operator Mono` or `Operator Mono SSm` fonts. Check out this https://github.com/kiliman/operator-mono-lig.

Thank you!

The most important question! Please sublime devs make it possible <3

Tangential, that site hijacks my CMD-F shortcut preventing me from searching in page.

I hate that.

Excited about this for the increased support for non-Latin languages and the code ligatures, but sad that it is pegging 2 cores at nearly 100%. Will look forward to when this is fully stable.

probably your projects are just being reindexed due to the syntax definition improvements? unless it's the famous Material Theme increased CPU usage problem or something lol

Can confirm Fira Code works fine, although the update has broken the interface a little bit, at least for me.

make sure you report it on the forum post with details like OS, screen resolution and theme, and it might get a quick fix - I've seen it happen before for other dev build bugs :)

Came home and checked for updates - they have fixed the issue (that was quick!).

Great! Time to update versions.

I'd rather they integrated SFTP/SCP natively into the editor instead of having to mock with third party extensions.

What does that have to do with ligatures?

He thinks the developers shouldn't waste time on this feature, and instead waste time on another feature that already has multiple solutions in the plugin library.

Since I don't think you would be able to do this kind of work in a plugin at all, and can clearly implement his feature in a plugin I feel like he can pound sand.

I think he just doesn't want to pay the pittance the developer of the best scp plugin wants for his work.

I have used editors that aren't as polished but handler file I/O better.

I think Sublime Text is very good but has fallen behind in terms of version control. I think Atom and VS Code are winning the war right now. Especially because the latter are free.

And Magit wipes the floor with them, so I guess all Atom and VS Code users should migrate to Emacs ;).

People judge editors along different dimensions. E.g. I have tried Visual Studio and Atom, but for me they (especially Atom) are simply to slow compared to Sublime/Emacs/vim.

I also used to think the same with respect to Sublime and Atom, but Atom got faster lately with respect to the first releases.

Then, it's possible to end up with really slow Emacs (e.g: Spacemacs is slow).

Atom got faster lately with respect to the first releases.

Yes, that's true – but it's still so, so much slower than Sublime that it's absolutely not worth it – for me, at least! Whatever tools work for you :)

I personally prefer version control in sublime with suitable plugins it's the debugging experience that I feel is lacking in sublime Vs vscode and atom

Sublime does not have the concept of panels so any kind of debugger in sublime looks and handles really bad

C++ programmer who switched from VS to Sublime here. That was the hardest part for me. Was a very hard learning curve with finding setting it all up and getting SublimeGDB and the GCC linter to work. But I'm glad I made the switch in the end. Everything from writing, to compiling is so much faster, nicer and less cluttered.

The Built-In Terminal in VSCode is something I would love to see in Sublime. For Ruby Coding this would be sufficient for me. For Go I currently prefer VSCode because of the debugging capabilities.

Implementing a "Built-in Terminal" mindset is what is wrong with VSCode/Atom etc. You already have a terminal emulator installed in your system, and you can tile the windows if you want a terminal right under your editor.

NIH syndrome of re-implementing everything under one roof is not really required, since we are heavily utilizing desktop environments for the past couple of decades, which allows you to put separate applications in one screen.

>Implementing a "Built-in Terminal" mindset is what is wrong with VSCode/Atom etc.

Electron is what is wrong with them -- if anything is.

Built-in terminal has nothing to do with it.

>NIH syndrome of re-implementing everything under one roof is not really required, since we are heavily utilizing desktop environments for the past couple of decades, which allows you to put separate applications in one screen.

That's less streamlined than having the editor directly cater to different needs. The "separate git terminal window" for example doesn't know anything about your open files and vice versa.

Terminal buffers have a long history and certainly aren't what's wrong with atom/vscode. I concur that that problem is "using a web browser as a ascii rendering engine".

I think the one thing that keeps terminal buffers out of sublime text is probably it's crossplatfomness. Seems like it would be a bit of a hairball to get right on every platform.

Why do people need git support in an editor so much? Using git from the terminal is easy and you always know what is executed because you do it manually.

For me, the big sell in Atom's git integration is seeing exactly which lines have been added / removed / modified in the gutter and the minimap, as well as seeing what branch you're in displayed in the status bar. I didn't use any of its other git integrations.

Sublime Text can handle the former with the plugin GitGutter. Atom's branch reminder is a nice-to-have but not something that I feel is necessary, so with the plugin I'm a happy camper with Sublime.

I'm in the same boat as you (I'm also doing "git diff"manually from the command line before each commit).

And to answer your question, probably for the same reason why people have moved on from Assembler to C to managed memory languages to JS and to today's JS frameworks, they want to avoid the "rough" parts by adding another layer of abstraction. For some people constantly going back to the terminal looks "rough", I guess.

> they want to avoid the "rough" parts by adding another layer of abstraction.

They've also become thousands of times more productive.

Thousands of times more productive, WOW! So we can replace companies entire dev departments with 1 person!

> So we can replace companies entire dev departments with 1 person!

Do entire dev departments use ASM for shitting out crappy electron apps? If it wasn't for all those abstractions, a large amount of today's developers wouldn't work in software development. Show some respect for those whose shoulders you sit upon.

Magit user here.

I am both comfortable with git on the command line and through emacs. I prefer magit mostly because of its contextual support. With the command line, each command can derive no context from the last command. With magit, it's easy to drill in and see more relevant data (or edit that data) quicker and easier.

Just wanted to point out that not everybody is merely looking for an easier experience, or one that looks prettier.

Sublimes git support is nice with GitGutter and GitSavvy Plug-ins. Try them. Specially GitSavvy is a totally keyboard driven approach that works well for me.

SublimeGit is one of the reasons I still use Sublime, even with all the VSCode hype.

The response was very negative, just to clarify: Sublime is a good editor. I've used it for work and side projects and it is great.

And in great part, Atom and VS Code could be said to be clones of Sublime. So don't take offense here.

Considering the raw performance of ST, which is leaps and bounds above that of VS Code and Atom, it's a steal at its current price. Personally I will continue using it for the foreseeable future, ligatures or not.

They certainly may be more popular. I feel that the sublime ecosystem is superior personally. I personally also prefer the Sublime API over Atoms or VSCodes

Call me when either of then have decent diff tool support.

Seriously, every diff tools sucks compared with commercial ones. e.g. BeyondCompare.

The diff tool that comes with Perforce is pretty decent. I also like another tool called Meld. IntelliJ has a great diff tool.

SVN in sublime text, although paid, is so much better than whatever VSCode has for SVN.

Applications are open for YC Summer 2021

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact