remove auto prefix. optimize getwinvar
This commit is contained in:
parent
b19a29675d
commit
e7c5bbb671
|
@ -28,19 +28,21 @@ function! airline#get_statusline(winnr, active)
|
||||||
let builder = airline#builder#new(a:active, s:highlighter)
|
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))
|
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('airline_a', s:get_section(a:winnr, 'a')
|
||||||
call builder.add_section('b', s:get_section(a:winnr, 'b'))
|
\ .'%{g:airline_detect_paste && &paste ? g:airline_paste_symbol." " : ""}')
|
||||||
call builder.add_section('c', s:get_section(a:winnr, 'c').' %#airline_file#%{&ro ? g:airline_readonly_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
|
else
|
||||||
call builder.add_section('c', '%f%m')
|
call builder.add_section('airline_c', '%f%m')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call builder.split(s:get_section(a:winnr, 'gutter', '', ''))
|
call builder.split(s:get_section(a:winnr, 'gutter', '', ''))
|
||||||
|
|
||||||
if airline#util#getwinvar(a:winnr, 'airline_render_right', 1)
|
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('airline_c', s:get_section(a:winnr, 'x'))
|
||||||
call builder.add_section('b', s:get_section(a:winnr, 'y'))
|
call builder.add_section('airline_b', s:get_section(a:winnr, 'y'))
|
||||||
call builder.add_section('a', s:get_section(a:winnr, 'z'))
|
call builder.add_section('airline_a', s:get_section(a:winnr, 'z'))
|
||||||
if a:active
|
if a:active
|
||||||
call builder.add_raw('%(')
|
call builder.add_raw('%(')
|
||||||
call builder.add_section('warningmsg', s:get_section(a:winnr, 'warning', '', ''))
|
call builder.add_section('warningmsg', s:get_section(a:winnr, 'warning', '', ''))
|
||||||
|
|
|
@ -8,7 +8,7 @@ function! s:prototype.split(gutter)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:prototype.add_section(group, contents)
|
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
|
endfunction
|
||||||
|
|
||||||
function! s:prototype.add_raw(text)
|
function! s:prototype.add_raw(text)
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
" MIT License. Copyright (c) 2013 Bailey Ling.
|
" MIT License. Copyright (c) 2013 Bailey Ling.
|
||||||
" vim: et ts=2 sts=2 sw=2
|
" vim: et ts=2 sts=2 sw=2
|
||||||
|
|
||||||
" for 7.2 compatibility
|
if v:version >= 703
|
||||||
function! airline#util#getwinvar(winnr, key, ...)
|
function! airline#util#getwinvar(winnr, key, def)
|
||||||
let winvals = getwinvar(a:winnr, '')
|
return getwinvar(a:winnr, a:key, a:def)
|
||||||
return get(winvals, a:key, (a:0 ? a:1 : ''))
|
endfunction
|
||||||
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)
|
function! airline#util#exec_funcrefs(list, break_early)
|
||||||
" for 7.2; we cannot iterate list, hence why we use range()
|
" for 7.2; we cannot iterate list, hence why we use range()
|
||||||
|
|
Loading…
Reference in New Issue