Setting up airline-vim

Recently I noticed, that my Vim configuration is getting a bit outdated. The configuration of one of my mate had a fancy status line, showed syntax errors when saving a buffer and he used vundle to manage his Vim plug-ins. I used to manage my Vim plug-ins with yaourt, a package manager for user packages in ArchLinux.

Installing vundle

First one needs to get the vundle plug-in via git:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Then one needs to setup Vim to use it:

" ~/.vimrc
set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()

Plugin 'gmarik/Vundle.vim'

filetype plugin indent on

From there adding additional plug-ins is as easy as adding a Plugin ... line right after the vundle plug-in.

So adding airline for a fancy status line, syntastic as a syntax checker and git support with fugitive is as easy as this:

Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-fugitive'
Plugin 'bling/vim-airline'

Configuring airline

Out of the box airline does show the status bar only if at least one split is active:

Vim screen shot with airline

Also the default symbols used in the statusline aren't that fancy. Adding set laststatus=2 enables the statusline by default and let g:airline_powerline_fonts = 1 lets one use the powerline fonts

Configuring my terminal emulator of choice, urxvt, turned out to be a bit of a hassle.

Installing the fonts was easy:

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

Then in ~/.Xresources configure urxvt to use a powerline font:

URxvt.font: xft:DejaVu Sans Mono for Powerline:size=11

Then reloading the configuration

xrdb -merge ~/.Xresources

The problem was that urxvt didn't like that at all and displayed the fonts with the spacing all messed up. After an hour of googling and trying out different stuff, it turned out I just needed to kill and restart the urxvtd daemon!

% killall urxvtd
% urxvtd -q -o -f

After that it worked like a charm and the special symbols did show up nicely:

Vim screen shot with airline and powerline fonts

blogroll

social