mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-05-18 06:19:42 +08:00
autocommands: check for existence of airline highlight group
Several extensions trigger custom actions. Make sure, those actions are only performed, if airline is actually active and not temporarily disabled using e.g. :AirlineToggle
This commit is contained in:
@@ -44,7 +44,7 @@ function! airline#extensions#tabline#xtabline#init()
|
||||
autocmd TabLeave * call s:Do('leave')
|
||||
autocmd TabClosed * call s:Do('close')
|
||||
|
||||
autocmd BufEnter * let g:xtabline_changing_buffer = 0
|
||||
autocmd BufEnter * if exists('#airline') | let g:xtabline_changing_buffer = 0 | endif
|
||||
autocmd BufAdd,BufDelete,BufWrite * call airline#extensions#tabline#xtabline#filter_buffers()
|
||||
augroup END
|
||||
|
||||
@@ -180,6 +180,10 @@ function! airline#extensions#tabline#xtabline#filter_buffers()
|
||||
" 'accepted' is a list of buffer numbers, for quick access.
|
||||
" 'excluded' is a list of buffer numbers, it will be used by Airline to hide buffers.
|
||||
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
if !s:xtabline_filtering | return | endif
|
||||
|
||||
let g:airline#extensions#tabline#exclude_buffers = []
|
||||
@@ -351,6 +355,10 @@ endfunction
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
||||
function! s:Do(action)
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
let arg = a:action
|
||||
if !s:state | call s:InitCwds() | return | endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user