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
|
return empty(text) ? '' : prefix.text.suffix
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:build_sections(builder, keys, winnr)
|
function! s:build_sections(builder, context, keys)
|
||||||
for key in a: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
|
" i have no idea why the warning section needs special treatment, but it's
|
||||||
" needed to prevent separators from showing up
|
" needed to prevent separators from showing up
|
||||||
if key == 'warning'
|
if key == 'warning'
|
||||||
call a:builder.add_raw('%(')
|
call a:builder.add_raw('%(')
|
||||||
endif
|
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'
|
if key == 'warning'
|
||||||
call a:builder.add_raw('%)')
|
call a:builder.add_raw('%)')
|
||||||
endif
|
endif
|
||||||
@ -42,7 +46,7 @@ function! airline#extensions#default#apply(builder, context)
|
|||||||
let active = a:context.active
|
let active = a:context.active
|
||||||
|
|
||||||
if airline#util#getwinvar(winnr, 'airline_render_left', active || (!active && !g:airline_inactive_collapse))
|
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
|
else
|
||||||
call a:builder.add_section('airline_a', '%f%m ')
|
call a:builder.add_section('airline_a', '%f%m ')
|
||||||
call a:builder.add_section('airline_c', '')
|
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', '', ''))
|
call a:builder.split(s:get_section(winnr, 'gutter', '', ''))
|
||||||
|
|
||||||
if airline#util#getwinvar(winnr, 'airline_render_right', 1)
|
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
|
endif
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user