config: allow to disable setting the statusline option

closes #2013
This commit is contained in:
Christian Brabandt 2019-12-13 09:59:45 +01:00
parent e395afed51
commit 5f9ae83f44
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
4 changed files with 26 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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
<

View File

@ -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')