diff --git a/.gitignore b/.gitignore index 66fb17dc..296f094e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ doc/tags *.lock +.vim-flavor diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 446c89d0..0aa3da50 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -27,7 +27,9 @@ function! airline#extensions#branch#get_head() endif endif - return empty(head) ? s:empty_message : s:symbol.' '.head + return empty(head) + \ ? s:empty_message + \ : printf('%s%s', empty(s:symbol) ? '' : s:symbol.' ', head) endfunction function! airline#extensions#branch#init(ext) diff --git a/t/extensions_default.vim b/t/extensions_default.vim new file mode 100644 index 00000000..9eb80235 --- /dev/null +++ b/t/extensions_default.vim @@ -0,0 +1,22 @@ +call airline#init#bootstrap() + +describe 'default' + before + let s:builder = airline#builder#new({'active': 1}) + end + + it 'should use the layout' + let g:airline#extensions#default#layout = [ + \ [ 'c', 'a', 'b', 'warning' ], + \ [ 'x', 'z', 'y' ] + \ ] + call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 }) + let stl = s:builder.build() + Expect stl =~ 'airline_c_to_airline_a' + Expect stl =~ 'airline_a_to_airline_b' + Expect stl =~ 'airline_b_to_airline_warning' + Expect stl =~ 'airline_x_to_airline_z' + Expect stl =~ 'airline_z_to_airline_y' + end +end +