diff --git a/autoload/airline.vim b/autoload/airline.vim index 1411941..81e5670 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -28,19 +28,21 @@ function! airline#get_statusline(winnr, active) let builder = airline#builder#new(a:active, s:highlighter) if airline#util#getwinvar(a:winnr, 'airline_render_left', a:active || (!a:active && !g:airline_inactive_collapse)) - call builder.add_section('a', s:get_section(a:winnr, 'a').'%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}') - call builder.add_section('b', s:get_section(a:winnr, 'b')) - call builder.add_section('c', s:get_section(a:winnr, 'c').' %#airline_file#%{&ro ? g:airline_readonly_symbol : ""}') + call builder.add_section('airline_a', s:get_section(a:winnr, 'a') + \ .'%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}') + call builder.add_section('airline_b', s:get_section(a:winnr, 'b')) + call builder.add_section('airline_c', s:get_section(a:winnr, 'c') + \ .'%#airline_file#%{&ro ? g:airline_readonly_symbol : ""}') else - call builder.add_section('c', '%f%m') + call builder.add_section('airline_c', '%f%m') endif call builder.split(s:get_section(a:winnr, 'gutter', '', '')) if airline#util#getwinvar(a:winnr, 'airline_render_right', 1) - call builder.add_section('c', s:get_section(a:winnr, 'x')) - call builder.add_section('b', s:get_section(a:winnr, 'y')) - call builder.add_section('a', s:get_section(a:winnr, 'z')) + call builder.add_section('airline_c', s:get_section(a:winnr, 'x')) + call builder.add_section('airline_b', s:get_section(a:winnr, 'y')) + call builder.add_section('airline_a', s:get_section(a:winnr, 'z')) if a:active call builder.add_raw('%(') call builder.add_section('warningmsg', s:get_section(a:winnr, 'warning', '', '')) diff --git a/autoload/airline/builder.vim b/autoload/airline/builder.vim index d35ae92..2e8226d 100644 --- a/autoload/airline/builder.vim +++ b/autoload/airline/builder.vim @@ -8,7 +8,7 @@ function! s:prototype.split(gutter) endfunction function! s:prototype.add_section(group, contents) - call add(self._sections, ['airline_'.a:group, a:contents]) + call add(self._sections, [a:group, a:contents]) endfunction function! s:prototype.add_raw(text) diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index daa3ea8..483b1e2 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -1,11 +1,16 @@ " MIT License. Copyright (c) 2013 Bailey Ling. " vim: et ts=2 sts=2 sw=2 -" for 7.2 compatibility -function! airline#util#getwinvar(winnr, key, ...) - let winvals = getwinvar(a:winnr, '') - return get(winvals, a:key, (a:0 ? a:1 : '')) -endfunction +if v:version >= 703 + function! airline#util#getwinvar(winnr, key, def) + return getwinvar(a:winnr, a:key, a:def) + endfunction +else + function! airline#util#getwinvar(winnr, key, def) + let winvals = getwinvar(a:winnr, '') + return get(winvals, a:key, def) + endfunction +endif function! airline#util#exec_funcrefs(list, break_early) " for 7.2; we cannot iterate list, hence why we use range()