mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-05-25 17:58:33 +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:
@@ -8,6 +8,10 @@ function! airline#extensions#tabline#buflist#invalidate()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#buflist#clean()
|
||||
if !exists('#airline')
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
call airline#extensions#tabline#buflist#invalidate()
|
||||
call airline#extensions#tabline#buffers#invalidate()
|
||||
endfunction
|
||||
|
||||
@@ -24,6 +24,9 @@ function! airline#extensions#tabline#ctrlspace#on()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#ctrlspace#invalidate()
|
||||
if !exists('#airline')
|
||||
return
|
||||
endif
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
endfunction
|
||||
|
||||
@@ -22,7 +22,9 @@ function! airline#extensions#tabline#tabs#on()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
if exists('#airline')
|
||||
let s:current_bufnr = -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabs#get()
|
||||
|
||||
@@ -24,8 +24,10 @@ function! airline#extensions#tabline#tabws#on()
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabws#invalidate()
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
if exists('#airline')
|
||||
let s:current_bufnr = -1
|
||||
let s:current_tabnr = -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#tabline#tabws#add_buffer_section(builder, cur_tab, cur_buf, pull_right)
|
||||
|
||||
@@ -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