mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-26 10:13:42 +08:00
hide warning section in inactive splits.
This commit is contained in:
parent
62fa3c37e4
commit
c858116f87
|
@ -23,14 +23,18 @@ function! s:get_section(winnr, key, ...)
|
|||
return empty(text) ? '' : prefix.text.suffix
|
||||
endfunction
|
||||
|
||||
function! s:build_sections(builder, keys, winnr)
|
||||
function! s:build_sections(builder, context, keys)
|
||||
for key in a:keys
|
||||
if key == 'warning' && !a:context.active
|
||||
continue
|
||||
endif
|
||||
|
||||
" i have no idea why the warning section needs special treatment, but it's
|
||||
" needed to prevent separators from showing up
|
||||
if key == 'warning'
|
||||
call a:builder.add_raw('%(')
|
||||
endif
|
||||
call a:builder.add_section('airline_'.key, s:get_section(a:winnr, key))
|
||||
call a:builder.add_section('airline_'.key, s:get_section(a:context.winnr, key))
|
||||
if key == 'warning'
|
||||
call a:builder.add_raw('%)')
|
||||
endif
|
||||
|
@ -42,7 +46,7 @@ function! airline#extensions#default#apply(builder, context)
|
|||
let active = a:context.active
|
||||
|
||||
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
|
||||
call <sid>build_sections(a:builder, s:layout[0], winnr)
|
||||
call <sid>build_sections(a:builder, a:context, s:layout[0])
|
||||
else
|
||||
call a:builder.add_section('airline_a', '%f%m ')
|
||||
call a:builder.add_section('airline_c', '')
|
||||
|
@ -51,7 +55,7 @@ function! airline#extensions#default#apply(builder, context)
|
|||
call a:builder.split(s:get_section(winnr, 'gutter', '', ''))
|
||||
|
||||
if airline#util#getwinvar(winnr, 'airline_render_right', 1)
|
||||
call <sid>build_sections(a:builder, s:layout[1], winnr)
|
||||
call <sid>build_sections(a:builder, a:context, s:layout[1])
|
||||
endif
|
||||
|
||||
return 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user