I have Fugitive vim and Airline vim installed via Vundle. I installed them as follow:

Plugin 'https://github.com/tpope/vim-fugitive.git'
Plugin 'vim-airline/vim-airline'

Airline status works fine. All of the functions in Fugitive works fine, such as Gcommit, Gpush... Now, I just want to have the name of the branch shows up on Airline. I've been searching around a lot, and most of the time, the problem is that doing :echo fugitive#head() does not show the correct branch. Mine works. It shows the correct branch. So, how to get it shows up in Vim Airline status bar? I tried: 152 let g:airline#extensions#branch#enabled = 1, this does not work.

I even tried to clean up entire .vim and .vimrc (start fresh from zero) and reinstalled Vundle, Fugitive, Airline... Still, the same problem occurs. What else do I need to add to my vimrc to make this works? Please let me know and thank you.

The .vimrc is as follow:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'https://github.com/Valloric/YouCompleteMe.git'  
Plugin 'https://github.com/ajh17/VimCompletesMe.git'
Plugin 'vim-airline/vim-airline'
Plugin 'https://github.com/tomasiser/vim-code-dark.git'
Plugin 'https://github.com/tpope/vim-fugitive.git' 
Plugin 'https://github.com/scrooloose/nerdcommenter.git' 

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line    

""""""""""""""""""  KEY MAPPINGS """"""""""""""""""""""""  

"To resize split
nnoremap <C-Right> <C-W>>
nnoremap <C-Left> <C-W><

nnoremap <C-Down>  :exe "resize " . (winheight(0) * 3/2)<CR>
nnoremap <C-Up>  :exe "resize " . (winheight(0) * 2/3)<CR>

"Move between splits   

nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

"Move between tabs 

map <C-t><up> :tabr<cr>

map <C-t><down> :tabl<cr>

map <C-t><left> :tabp<cr>

map <C-t><right> :tabn<cr>

"Buffer maps
:nnoremap <C-n> :bnext<CR>
:nnoremap <C-p> :bprevious<CR>

map <F12> :!sh -xc 'clear && gfortran shocktest.f95 && ./a.out' <enter>

map <F8> :!sh -xc 'gnuplot shockplot &&  eog --fullscreen RHO.png ' <enter>   

""""""""""""""""""  THEMES  """"""""""""""""""""""""  

colo codedark 
set cursorline 
hi MatchParen cterm=bold ctermbg=yellow ctermfg=red
""""""""""""""" AIRLINE STUFF """"""""""""""""""""""

let g:airline_theme='codedark'
let g:airline_section_b = '%{strftime("%I:%M %p")}'
let g:airline#extensions#branch#enabled = 1

"""""""""""""""" FORTRAN STUFF """"""""""""""""""""""""

" Ensure correct highlighting for
" Fortran free-form source code
" and turn syntax highlighting on
let fortran_free_source=1
let fortran_do_enddo=1
filetype plugin indent on
syntax on

" Turn on line numbers and
" row/column numbers
set nu
set ruler

" Make vim echo commands as they
" are being entered.
set showcmd

" Set tabstops to two spaces
" and ensure tab characters are
" expanded into spaces.
set smarttab
set expandtab
set tabstop=2
set shiftwidth=2

" Fix backspace key
set bs=2

" Set up searching so
" that it jumps to matches
" as the word is being
" entered and is case-insensitive
set incsearch
set ignorecase
set smartcase

" Uncomment the following lines to make
" vim automatically create a backup copy
" each time a file is edited.
" If you enable this feature, be sure to
"   mkdir ~/codeBackups
" or it won't work.
"set backupdir=~/codeBackups
"set backup
  • Could you post here your minimal vimrc, the one that you're testing this on? Just to help us get same settings and check if it's reproducible.
    – 3N4N
    Mar 5, 2019 at 7:13
  • I just did. Please see the vimrc
    – mle0312
    Mar 5, 2019 at 7:18
  • Strange! I'm able to reproduce the problem. Moreover it seems that fugitive-branch is shown when in netrw buffer. Can you confirm that? Just do :Ex and check if branch name shows up.
    – 3N4N
    Mar 5, 2019 at 7:31
  • Yes, doing :Ex opens up a a tree-like directory of the Git directory that I am in. The Airline status bar shows: netrw, and the correct git branch.
    – mle0312
    Mar 5, 2019 at 7:34
  • 1
    Airline maintainer here: please come up with a minimal reproducing example, you are currently overwriting the section_b which is supposed to display the branch name, so that explains why you are not seeing the branch extension. Mar 5, 2019 at 13:31

1 Answer 1


Had the same issue. Adding branch in airline_extension list solved the issue for me

let g:airline_extensions = ['hunks', 'branch', 'tabline']

Without branch in the list, it was not loading the branch extension altogether.

Your Answer

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

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