From fae68dbcb74b3d7a3144a9b57253b5051f26e207 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Mon, 20 Jan 2014 12:39:33 -0500 Subject: [PATCH] account for possibilty of branch extension unavailable. resolves #419. --- autoload/airline/extensions/branch.vim | 1 - autoload/airline/extensions/netrw.vim | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index d0a0818..82fd139 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -47,7 +47,6 @@ function! airline#extensions#branch#get_head() let empty_message = get(g:, 'airline#extensions#branch#empty_message', \ get(g:, 'airline_branch_empty_message', '')) let symbol = get(g:, 'airline#extensions#branch#symbol', g:airline_symbols.branch) - return empty(head) \ ? empty_message \ : printf('%s%s', empty(symbol) ? '' : symbol.(g:airline_symbols.space), head) diff --git a/autoload/airline/extensions/netrw.vim b/autoload/airline/extensions/netrw.vim index 35c6e0a..debb088 100644 --- a/autoload/airline/extensions/netrw.vim +++ b/autoload/airline/extensions/netrw.vim @@ -7,11 +7,15 @@ endif function! airline#extensions#netrw#apply(...) if &ft == 'netrw' - call a:1.add_section('airline_a', ' netrw ') - call a:1.add_section('airline_b', ' %{airline#extensions#branch#get_head()} ') - call a:1.add_section('airline_c', ' %f ') + let spc = g:airline_symbols.space + + call a:1.add_section('airline_a', spc.'netrw'.spc) + if exists('*airline#extensions#branch#get_head') + call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc) + endif + call a:1.add_section('airline_c', spc.'%f'.spc) call a:1.split() - call a:1.add_section('airline_y', ' %{airline#extensions#netrw#sortstring()} ') + call a:1.add_section('airline_y', spc.'%{airline#extensions#netrw#sortstring()}'.spc) return 1 endif endfunction @@ -24,5 +28,5 @@ endfunction function! airline#extensions#netrw#sortstring() let order = (g:netrw_sort_direction =~ 'n') ? '+' : '-' - return g:netrw_sort_by . ' [' . order . ']' + return g:netrw_sort_by . (g:airline_symbols.space) . '[' . order . ']' endfunction