How to view full path in statusline of Vim

This post shows how to quickly view the full path of the currently open file in Vim.

Some of you might like have the full path of file always be shown in the statusline. To do this set the %F item in the statusline. For example:

set statusline += '%F'

If you are using the vim-airline plugin, you can display the full path in its statusline by replacing the %f in its g:airline_section_c variable with %F. This post shows how you can view the current value of this variable.

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

get_hunks error with vim-airline plugin

Problem

After installing the latest version of vim-airline plugin for Vim, opening any file generates the following error:

Error detected while processing function airline#extensions#hunks#get_hunks..<SNR>57_get_hunks..<SNR>57_get_hunks_signify:
line    1:
E117: Unknown function: sy#repo#get_stats
Press ENTER or type command to continue
Error detected while processing function airline#extensions#hunks#get_hunks..<SNR>57_get_hunks..<SNR>57_get_hunks_signify:
line    1:
E15: Invalid expression: sy#repo#get_stats()
Press ENTER or type command to continue
Error detected while processing function airline#extensions#hunks#get_hunks..<SNR>57_get_hunks..<SNR>57_get_hunks_signify:
line    2:
E121: Undefined variable: hunks

Solution

This error is typically caused because one of your other Vim plugins is outdated. Most probably, the vim-signify or vim-gitgutter plugins. Try updating them and see if this error goes away.

If the error still persists, then the hunks feature can be safely disabled by adding this to your .vimrc:

let g:airline_enable_hunks = 0

Tried with: Vim 7.3 and Ubuntu 12.04 LTS

How to install and use the vim-airline plugin for Vim

Vim using vim-airline for statusline

vim-airline is a newer and lighter alternative to the vim-powerlinee plugin. It shows a beautiful and informative statusline in Vim.

Installation

The vim-airline plugin can beΒ installed for PathogenΒ by cloning itsΒ Github repository.

Fancy symbols

vim-airline can display those fancy symbols in the statusline in just a few steps:

  1. Download the powerline-fonts that have been patched to have the fancy powerline symbols.
  2. In the downloaded fonts, find the font that you use for your terminal and copy over those fonts to ~/.fonts
  3. Install the fonts using: fc-cache -vf ~/.fonts
  4. Once installed, configure your terminal to use these fonts. For GNOME Terminal, this can be done in Edit > Profile Preferences > General.
  5. Enable fancy symbols by adding this line to your vimrc: let g:airline_powerline_fonts=1

Tried with: Vim 7.3 and Ubuntu 12.04 LTS