Consolas font in Vim Powerline Windows

Update: Fixed a small rendering issue with the left-facing block arrow. If you noticed a thin line to the right of that arrow (you can actually see it in the screenshot below if you look hard), grab the latest version. That fixes the problem.


A colleague of mine introduced me to the beauty of Powerline, for Vim. In short, it’s a very beautiful status bar for Vim. It looks like this:


Powerline is a utility plugin which allows you to create better-looking, more functional vim statuslines.

The status bar uses some fancy symbols that are not found in a normal font. The pretty right and left facing arrows you see are those fancy symbols. Hence, Kim (Lokaltog), the author of Powerline, provides a “font patch” to patch any given font with the correct symbols, so that Powerline can look, well, beautiful. If that fails, there is a revert, that doesn’t use fancy symbols, which looks like this:


I don’t know about you, but to me, that’s a far cry from the beautiful, if I may say, real, Powerline.


So what’s the problem? The problem is that the font patch to make the fancy symbols appear doesn’t work with the Consolas font. And Consolas is a very beautiful and elegant font for programming. In pursuing the Consolas font patch, I experienced various things, from the font being uninstallable, to it installing but rendering horrendously. Absolutely losing the quality of the beautiful Consolas. Hence, this post is about Powerline with Consolas. If you’re not a fan of Consolas, then this really isn’t for you :)

So, the problem with using this with gVim, on Windows, is that the Consolas font cannot be patched correctly. After going through loops, and learning quite a bit about fonts in the process (that’s a good thing!), what I’ve provided here is a set of already fixed Consolas fonts, for all the four default font-faces (regular, bold, italics, bold-italics).

Here’s my Vim with Consolas, and Powerline:

{% imgcap /images/vimPowerlineWithConsolas1-1024x731.png Powerline for Vim with Consolas font %}

I like light themes, hence the difference from the first screenshot, but in any case, the point is the fancy bar!

In order to use these files, you also need to fix up your .vimrc. For convenience, here’s the part that matters:

set encoding=utf-8
set guifont=Consolas for Powerline FixedD:h9
let g:Powerline_symbols="fancy"

The encoding setting is to tell Vim to display the UTF symbols correctly. The patched file contains those fancy arrow-like symbols as part of a UTF-8 encoding, so Vim needs to know about that in order to display that correctly.

The FixedD part is just a random name I gave it, as I iterated through the patching. The h9 refers to the font size I want. That means a 9 point font size. Change it to whatever pleases you.

The Powerline_symbols setting is to tell Powerline to use the fancy symbols so that you get the nice arrow-like effect. It’s an internal Powerline setting.

As a note, it’ll be a good idea to hit :PowerlineClearCache.

Finally, and of course, I assume you already have your basic Powerline functioning. If you don’t, do check out the package manager Vundle, which makes installing Powerline a breeze. But that’s for another time!