tabline: skip expansive BufAdd call on Session load

closes #2015
This commit is contained in:
Christian Brabandt 2019-12-13 08:44:15 +01:00
parent 758c83acbf
commit 9c3f84fc67
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 10 additions and 2 deletions

View File

@ -54,10 +54,15 @@ function! s:toggle_on()
set tabline=%!airline#extensions#tabline#get()
endfunction
function! s:update_tabline()
function! s:update_tabline(forceit)
if get(g:, 'airline#extensions#tabline#disable_refresh', 0)
return
endif
" loading a session file
" On SessionLoadPost, g:SessionLoad variable is still set :/
if !a:forceit && get(g:, 'SessionLoad', 0)
return
endif
let match = expand('<afile>')
if pumvisible()
return
@ -155,7 +160,10 @@ function! airline#extensions#tabline#get()
endif
if !exists('#airline#BufAdd#*')
autocmd airline BufAdd * call <sid>update_tabline()
autocmd airline BufAdd * call <sid>update_tabline(0)
endif
if !exists('#airline#SessionLoadPost*')
autocmd airline SessionLoadPost * call <sid>update_tabline(1)
endif
if s:ctrlspace
return airline#extensions#tabline#ctrlspace#get()