Search code examples
vimfontspowerlinevim-airline

Powerline symbols in vim working for Monaco, but no other font


I've been using airline in Vim for quite some time now, with a variety of different fonts. However, I recently switched to a new machine, and I can't seem to get my powerline glyphs to work with any font except for an explicitly patched Monaco (from the monaco-powerline-font-git AUR package). I have tried a couple of other fonts, such as Hack and Iosevka, which ostensibly have Powerline glyphs built in and, as far as I can tell, work out-of-the-box for others.

For comparison, here's what it looks like with the patched Monaco:

Monaco for Powerline

As you can see, all glyphs are displaying normally.

Here's what it looks like with Hack and Iosevka:

Hack Iosevka

The Powerline glyphs seem to have been replaced by a bunch of ugly placeholders.

I don't mind Monaco too much, but I would prefer having some flexibility in choosing a modern font with built-in Powerline support.

Does anyone have an idea what I need to do to fix this?

Here are some system details, although I don't know which of these are actually relevant:

OS: Arch Linux
Editor: Neovim
Terminal Emulator: Termite (but the issue is identical in gnome-terminal as well as GVim)


Solution

  • I figured it out. For some reason, I had the following in my .vimrc:

    let g:airline_left_sep                            = '⮀'
    let g:airline_left_alt_sep                        = '⮁'
    let g:airline_right_sep                           = '⮂'
    let g:airline_right_alt_sep                       = '⮃'
    let g:airline_symbols.branch                      = '⭠'
    let g:airline_symbols.readonly                    = '⭤'
    let g:airline_symbols.linenr                      = '⭡'
    

    This was essentially hardcoding some glyphs, which are apparently unique to Monaco-for-Powerline (and which will show up correctly if you paste them into an editor with that font enabled). Removing these lines enables the correct glyphs for all fonts (incuding Monaco-for-Powerline).