As soon as the vim opened, error detected as follows. When press ENTER, the error occured repeated over and over again so that I can hardly make other operations. Once I opened tagbar with difficulty, it works as expected in vim opend this time. However, next time it will repeat the above annoying problem.
Error detected while processing function airline#extensions#tagbar#currenttag:
line 3:
E117: Unknown function: tagbar#currenttag
Press ENTER or type command to continue
Error detected while processing function airline#extensions#tagbar#currenttag:
line 3:
E15: Invalid expression: tagbar#currenttag('%s', '', s:flags)
Press ENTER or type command to continue
No error raised when vim opened.
have you updated your tagbar plugin?
I have tried using vim-plug to update all the plugins.
And it still happens? Can you find out, why the tagbar#currenttag() function is not available for you?
I try echoing the function argument s:flags, but it seems empty and outputs nothing. No more ideas come to my mind by far. Or could you give me an advice how to debug this? I'm not so much familiar with vimscript. Thanks!
function! airline#extensions#tagbar#currenttag()
if get(w:, 'airline_active', 0)
if s:airline_tagbar_last_lookup_time != localtime()
echo s:flags
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
what is your mini vimrc? I think it is due to lazy load tagbar. I want to test for it.
Here is my complete vim configuration. I guess .vimrc.plug.list could be the mini vimrc. I have disabled tagbar for the present. @wsdjeg
Am 2016-11-07 01:21, schrieb Liu-Cheng Xu:
Here [1] is my complete vim configuration. I guess .vimrc.plug.list
[2] could be the mini vimrc. I have disabled tagbar for the present.
@wsdjeg [3]
Then the solution is simple: do not lazy load tagbar.
@chrisbra Fixed without lazy load tagbar. However, it would be great to have a better solution.
Am 2016-11-07 11:20, schrieb Liu-Cheng Xu:
@chrisbra [1] Fixed without lazy load tagbar. However, it would be
great to have a better solution.
Lazy loading is a plugin manager hack, that is usually not necessary.
Well behaving plugins support lazy loading by themselves and so does
tagbar (the actual code is in the autoload folder).
@chrisbra Thanks for your explanation.
If you want to lazy load tagbar, while keep airline working, you can also disable airline's tagbar integration by adding the following lines in your vimrc:
let g:airline#extensions#tagbar#enabled = 0
My tagbar is configured as Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' } and this works fine.
Thanks, @reorx , I can confirm your solution works.
Why do you think, you need lazy loading?
@chrisbra in some cases when I'm jumping around with massive code files, if tagbar is automatically loaded, the startup time will increase, and navigating will become a bit slower, which makes me feel inefficient. Also, tagbar is not frequently used, but still necessary to me occasionally, those are the reasons why I want it to be lazy loaded.
@reorx that's why tagbar by itself uses the autoload folding. Which is lazy loading build in of Vim, as I explained earlier.
@chrisbra In that case, I think I can just remove { 'on': 'TagbarToggle' }, but still keep let g:airline#extensions#tagbar#enabled = 0 so that airline will not trigger tagbar to be loaded, am I understanding correctly?
Most helpful comment
@chrisbra In that case, I think I can just remove
{ 'on': 'TagbarToggle' }, but still keeplet g:airline#extensions#tagbar#enabled = 0so that airline will not trigger tagbar to be loaded, am I understanding correctly?