allow disabling airline per-buffer

This commit is contained in:
midchildan 2019-12-22 21:26:59 +09:00
parent bc0e2a3438
commit 9779a7a340
No known key found for this signature in database
GPG Key ID: D9A5748BACC6E3C2
2 changed files with 20 additions and 3 deletions

View File

@ -66,6 +66,17 @@ function! airline#util#prepend(text, minwidth)
return empty(a:text) ? '' : a:text.s:spc.g:airline_right_alt_sep.s:spc
endfunction
if v:version >= 704
function! airline#util#getbufvar(bufnr, key, def)
return getbufvar(a:bufnr, a:key, a:def)
endfunction
else
function! airline#util#getbufvar(bufnr, key, def)
let bufvals = getbufvar(a:bufnr, '')
return get(bufvals, a:key, a:def)
endfunction
endif
if v:version >= 704
function! airline#util#getwinvar(winnr, key, def)
return getwinvar(a:winnr, a:key, a:def)
@ -172,9 +183,10 @@ endfunction
function! airline#util#stl_disabled(winnr)
" setting the statusline is disabled,
" either globally or per window
" either globally, per window, or per buffer
" w:airline_disabled is deprecated!
return get(g:, 'airline_disable_statusline', 0) ||
\ airline#util#getwinvar(a:winnr, 'airline_disable_statusline', 0) ||
\ airline#util#getwinvar(a:winnr, 'airline_disabled', 0)
\ airline#util#getwinvar(a:winnr, 'airline_disabled', 0) ||
\ airline#util#getbufvar(winbufnr(a:winnr), 'airline_disable_statusline', 0)
endfunction

View File

@ -234,10 +234,15 @@ values):
<
Old deprecated name: `w:airline_disabled`
See also the following option, for disabling setting the statusline globally
See also the following options, for disabling setting the statusline
globally or per-buffer
* Disable setting the statusline option: >
" disable globally
let g:airline_disable_statusline = 1
" disable per-buffer
let b: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.