tagbar: only try loading the tagbar extension once
commit 232b641
did unfortunately disable tagbar completely, since
exists("*func") does not autoload the function.
So this time, try explicitly calling the function once, and if it does
not exists, it should be disabled and not cause any further errors.
closes #1555
This commit is contained in:
parent
f0a508b121
commit
9e3fcc4cdb
@ -9,6 +9,7 @@ endif
|
|||||||
|
|
||||||
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
|
let s:flags = get(g:, 'airline#extensions#tagbar#flags', '')
|
||||||
let s:spc = g:airline_symbols.space
|
let s:spc = g:airline_symbols.space
|
||||||
|
let s:init=0
|
||||||
|
|
||||||
" Arguments: current, sort, fname
|
" Arguments: current, sort, fname
|
||||||
function! airline#extensions#tagbar#get_status(...)
|
function! airline#extensions#tagbar#get_status(...)
|
||||||
@ -29,6 +30,16 @@ let s:airline_tagbar_last_lookup_time = 0
|
|||||||
let s:airline_tagbar_last_lookup_val = ''
|
let s:airline_tagbar_last_lookup_val = ''
|
||||||
function! airline#extensions#tagbar#currenttag()
|
function! airline#extensions#tagbar#currenttag()
|
||||||
if get(w:, 'airline_active', 0)
|
if get(w:, 'airline_active', 0)
|
||||||
|
if !s:init
|
||||||
|
try
|
||||||
|
" try to load the plugin, if filetypes are disabled,
|
||||||
|
" this will cause an error, so try only once
|
||||||
|
let a=tagbar#currenttag('%', '', '')
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
unlet! a
|
||||||
|
let s:init=1
|
||||||
|
endif
|
||||||
" function tagbar#currenttag does not exist, if filetype is not enabled
|
" function tagbar#currenttag does not exist, if filetype is not enabled
|
||||||
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
|
if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag")
|
||||||
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
|
let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)
|
||||||
|
Loading…
Reference in New Issue
Block a user