27

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?

6
  • 1
    seems related: vi.stackexchange.com/questions/3359/…
    – k0pernikus
    Nov 27, 2015 at 14:41
  • Don't set t_Co. Instead, set TERM=xterm-256color from the shell before starting Vim.
    – muru
    Nov 27, 2015 at 18:01
  • 1
    See: vi.stackexchange.com/a/1891/205
    – muru
    Nov 27, 2015 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, 2015 at 18:09
  • 1
    @muru This useful information that I think that this could be a nice answer to a follow-up question; I just haven't thought about a catchy name besides "Should I use t_Co to set colors?"
    – k0pernikus
    Nov 27, 2015 at 18:12

2 Answers 2

30

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 [email protected]: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

6
  • I'd guess the colorscheme is one of the solarized themes.
    – muru
    Nov 27, 2015 at 18:04
  • 1
    how did you get the git branch to appear? Nov 27, 2015 at 18:47
  • 2
    @user4668401 that could be the fugitive plugin
    – k0pernikus
    Nov 27, 2015 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? Oct 20, 2016 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, 2016 at 13:36
0

just do this

let g:airline_powerline_fonts = 1

Even I had stuggled with the same. If it didnt show properly then just set you terminal font to something like Cascadia Code PL (PL for powerline) or anyother powerline font. If you use neovim-qt then set this

GuiFont AnyPlFont:h:size
GuiFont Cascadia Code PL:h:20

How it worked for me

1
  • Welcome to Vi and Vim! I think most of this information is covered in the existing answer on using a powerline font.
    – D. Ben Knoble
    Sep 22, 2021 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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