22

I am trying to get the vim-airline up and running.

I have required it via vundle in my ~./vimrc:

Plugin 'bling/vim-airline'

I have installed it and expected my Vim to look like the screenshot on its project page:

Expected Vim theme

Yet it looks like this:

Actual look of my Vim instance

Concerning the fonts, I tried adding:

let g:airline_powerline_fonts = 1

Yet the icons then are just gibberish.

What am I missing?


I just found that for the colors, as described in the FAQ, I can add in my .vimrc:

set t_Co=256

Yet this still leads to line looks distorted:

Vim with t_Co=256

Especially the Git integration about (branch name with the icon). Or the the way the >-"arrow" is displayed. I want that eye-candy, too. Can I even achieve that in Bash? Or would I need a different shell?

Basically, I want Vim to look like the example screenshot on the plugin page, as I expected it to be the default of the plugin. How can I achieve that?

  • 1
    seems related: vi.stackexchange.com/questions/3359/… – k0pernikus Nov 27 '15 at 14:41
  • Don't set t_Co. Instead, set TERM=xterm-256color from the shell before starting Vim. – muru Nov 27 '15 at 18:01
  • @muru Could you please elaborate the the harm of setting t_Co? – k0pernikus Nov 27 '15 at 18:02
  • 1
    See: vi.stackexchange.com/a/1891/205 – muru Nov 27 '15 at 18:02
  • 1
    Also: i.stack.imgur.com/hkWc5.png for a comparison. The Vim on the left was started with TERM=xterm-256color, on the right, with TERM=xterm and :set t_Co=256. The one on the left looks like it has a grey background, but that's a screenshot artifact - it's actually transparent, and I could see my wallpaper and the browser window behind it. With t_Co=256, that understanding of the terminal is lost and the background is solid black. Better screenshot: i.stack.imgur.com/kMf7c.png – muru Nov 27 '15 at 18:09
24

One has to realize that the feature implemented by airline are inspired by the powerline plugin.

Furthermore, I was relying on the docs too much, not realizing that there is well-written airline help document shipped with itself:

:h airline

Reading its documentation helps understanding the functionality of this plugin.

Font

As mentioned in the powerline docs:

Powerline uses several special glyphs to get the arrow effect and some custom symbols for developers. This requires having either a symbol font or a patched font installed in the system. Used application (e.g. terminal emulator) must also either be configured to use patched fonts (in some cases even support it because custom glyphs live in private use area which some applications reserve for themselves) or support fontconfig for powerline to work properly with powerline-specific glyphs.

So one can patch existing fonts (see the powerline font section docs or you may install a collection or already prepared fonts.

You can install a powerline font collection via:

git clone git@github.com:powerline/fonts.git
cd fontd
./install.sh

I have chosen Meslo LG L DZ for Powerline in my terminal.

One has to add to .vimrc:

let g:airline_powerline_fonts = 1

Colors

For the colors, you have to set in your .vimrc:

set t_Co=256

as desribed in the FAQ.

Theme

In order to see your current theme, run:

 :AirlineTheme

for me the default was dark.

You can change them for the current session by:

 :AirlineTheme THEME_NAME

You can find a list of themes here.

@todo: Find out theme used in the screenshot. I actually like luna more, yet that is an entirely different matter.

My changes currently let vim look like this:

current state of vim look

  • I'd guess the colorscheme is one of the solarized themes. – muru Nov 27 '15 at 18:04
  • 1
    how did you get the git branch to appear? – the_velour_fog Nov 27 '15 at 18:47
  • 1
    @user4668401 that could be the fugitive plugin – k0pernikus Nov 27 '15 at 18:57
  • I had the same problem but the solution didn't work for my case. I have diamonds rather than the nice shapes. I am using in a console (tty1) and not a terminal, thus I only have 8 colors (debian without GUI install). Is that answer relevant to my problem or do I have to ask a new question? – LittleNooby Oct 20 '16 at 11:23
  • @LittleNooby OP here. I just checked on my tty1 in Ubuntu, and there I also have the diamond shapes for the vim airline plugin. I suspect it's a font issue for tty, I would say it's a specific enough to warrant a question of its own. – k0pernikus Oct 20 '16 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.