From c858116f8727669308aa40e1df22a5b7078b4317 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Sun, 1 Sep 2013 10:24:24 -0400 Subject: [PATCH] hide warning section in inactive splits. --- autoload/airline/extensions/default.vim | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/autoload/airline/extensions/default.vim b/autoload/airline/extensions/default.vim index c24a1f5..4ae686c 100644 --- a/autoload/airline/extensions/default.vim +++ b/autoload/airline/extensions/default.vim @@ -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 build_sections(a:builder, s:layout[0], winnr) + call 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 build_sections(a:builder, s:layout[1], winnr) + call build_sections(a:builder, a:context, s:layout[1]) endif return 1