From 5f9ae83f441b8714e843459a330f2e98995833f9 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 13 Dec 2019 09:59:45 +0100 Subject: [PATCH] config: allow to disable setting the statusline option closes #2013 --- autoload/airline.vim | 4 ++-- autoload/airline/util.vim | 9 +++++++++ doc/airline.txt | 13 +++++++++++-- plugin/airline.vim | 6 ++++-- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/autoload/airline.vim b/autoload/airline.vim index 27a8646d..4b950df4 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -125,7 +125,7 @@ endfunction " Update the statusline function! airline#update_statusline() - if airline#util#getwinvar(winnr(), 'airline_disabled', 0) + if airline#util#stl_disabled() return endif let range = filter(range(1, winnr('$')), 'v:val != winnr()') @@ -154,7 +154,7 @@ endfunction " Function to draw inactive statuslines for inactive windows function! airline#update_statusline_inactive(range) - if airline#util#getwinvar(winnr(), 'airline_disabled', 0) + if airline#util#stl_disabled() return endif for nr in a:range diff --git a/autoload/airline/util.vim b/autoload/airline/util.vim index b1df18a3..5e482755 100644 --- a/autoload/airline/util.vim +++ b/autoload/airline/util.vim @@ -161,3 +161,12 @@ function! airline#util#themes(match) let files = split(globpath(&rtp, 'autoload/airline/themes/'.a:match.'*.vim'), "\n") return sort(map(files, 'fnamemodify(v:val, ":t:r")') + ['random']) endfunction + +function! airline#util#stl_disabled() + " setting the statusline is disabled, + " either globally or per window + " w:airline_disabled is deprecated! + return get(g:, 'airline_disable_statusline', 0) || + \ airline#util#getwinvar(winnr(), 'airline_disable_statusline', 0) || + \ airline#util#getwinvar(winnr(), 'airline_disabled', 0) +endfunction diff --git a/doc/airline.txt b/doc/airline.txt index 2da18221..cd1cb8aa 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -228,10 +228,19 @@ values): heavily) > let g:airline_exclude_preview = 0 < -* disable the Airline customization for selected windows (this is a +* disable the Airline statusline customization for selected windows (this is a window-local variable so you can disable it per-window) > - let w:airline_disabled = 1 + let w:airline_disable_statusline = 1 +< + Old deprecated name: `w:airline_disabled` + See also the following option, for disabling setting the statusline globally +* Disable setting the statusline option: > + let g:airline_disable_statusline = 1 + +< This setting disables setting the 'statusline' option. This allows to use + e.g. the tabline extension (|airline-tabline|) but keep the 'statusline' + option totally configurable by a custom configuration. * Do not draw separators for empty sections (only for the active window) > let g:airline_skip_empty_sections = 1 < diff --git a/plugin/airline.vim b/plugin/airline.vim index 0fded917..c1c2ee21 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -178,8 +178,10 @@ function! s:airline_toggle() endif augroup END - if &laststatus < 2 - set laststatus=2 + if !airline#util#stl_disabled() + if &laststatus < 2 + set laststatus=2 + endif endif if s:airline_initialized call s:on_window_changed('Init')