From 9e3fcc4cdb5244361939e8e6410263366f0295cd Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 1 Sep 2017 09:08:22 +0200 Subject: [PATCH] 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 --- autoload/airline/extensions/tagbar.vim | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/autoload/airline/extensions/tagbar.vim b/autoload/airline/extensions/tagbar.vim index 3a351d2..53c9edc 100644 --- a/autoload/airline/extensions/tagbar.vim +++ b/autoload/airline/extensions/tagbar.vim @@ -9,6 +9,7 @@ endif let s:flags = get(g:, 'airline#extensions#tagbar#flags', '') let s:spc = g:airline_symbols.space +let s:init=0 " Arguments: current, sort, fname 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 = '' function! airline#extensions#tagbar#currenttag() 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 if s:airline_tagbar_last_lookup_time != localtime() && exists("*tagbar#currenttag") let s:airline_tagbar_last_lookup_val = tagbar#currenttag('%s', '', s:flags)