From f76ede3b28d5f87a9433f85b1f171aff433f3765 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Mon, 10 Apr 2017 09:17:23 +0200 Subject: [PATCH] Make skip_empty variable overridable per window The denite extension functions return the content of some buffer-local variables. Those variables are not defined, the first time the they are accessed and therefore, the statusline is not updated later when g:airline_skip_empty_sections is set. So disable this variable in this window, by setting the w:airline_skip_empty_section=0 variable in the denite window. closes #1454 --- autoload/airline/builder.vim | 5 +++++ autoload/airline/extensions/denite.vim | 1 + doc/airline.txt | 6 ++++++ 3 files changed, 12 insertions(+) diff --git a/autoload/airline/builder.vim b/autoload/airline/builder.vim index d566a32f..20b4944e 100644 --- a/autoload/airline/builder.vim +++ b/autoload/airline/builder.vim @@ -161,6 +161,11 @@ function! s:section_is_empty(self, content) if get(g:, 'airline_skip_empty_sections', 0) == 0 return 0 endif + + " only check, if airline#skip_empty_sections == 1 + if get(w:, 'airline_skip_empty_sections', 0) == 0 + return 0 + endif " assume accents sections to be never empty " (avoides, that on startup the mode message becomes empty) if match(a:content, '%#__accent_[^#]*#.*__restore__#') > -1 diff --git a/autoload/airline/extensions/denite.vim b/autoload/airline/extensions/denite.vim index 2662438f..672efbd9 100644 --- a/autoload/airline/extensions/denite.vim +++ b/autoload/airline/extensions/denite.vim @@ -19,6 +19,7 @@ endfunction function! airline#extensions#denite#apply(...) if &ft == 'denite' + let w:airline_skip_empty_sections = 0 call a:1.add_section('airline_a', ' Denite %{airline#extensions#denite#check_denite_mode('.a:2['bufnr'].')}') call a:1.add_section('airline_c', ' %{denite#get_status_sources()}') call a:1.split() diff --git a/doc/airline.txt b/doc/airline.txt index afd31c46..26121008 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -148,6 +148,12 @@ values): > let g:airline_skip_empty_sections = 1 < + + This variable can be overriden by setting a window-local variable with + the same name (in the correct window): + > + let w:airline_skip_empty_sections = 0 +< ============================================================================== COMMANDS *airline-commands*