tagbar: only lookup tag once every second

This makes scrolling (holding done j/k) much smoother, and the current
tag gets pulled in via CursorHold anyway.

Fixes https://github.com/bling/vim-airline/issues/387
This commit is contained in:
Daniel Hahler 2013-12-21 02:16:54 +01:00
parent dbd6c4a71a
commit 2dc416aa8f
1 changed files with 7 additions and 1 deletions

View File

@ -23,9 +23,15 @@ function! airline#extensions#tagbar#inactive_apply(...)
endif
endfunction
let s:airline_tagbar_last_lookup_time = 0
let s:airline_tagbar_last_lookup_val = ''
function! airline#extensions#tagbar#currenttag()
if get(w:, 'airline_active', 0)
return tagbar#currenttag('%s', '', s:flags)
if s:airline_tagbar_last_lookup_time != localtime()
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
let s:airline_tagbar_last_lookup_time = localtime()
endif
return s:airline_tagbar_last_lookup_val
endif
return ''
endfunction