Vim-airline: Error detected with extension tagbar when vim opened

Created on 5 Nov 2016  路  16Comments  路  Source: vim-airline/vim-airline

environment

  • vim: 8.0, included patches: 1-55
  • vim-airline: the latest
  • OS: macOS 10.12
  • Have you reproduced with a minimal vimrc: yes
    if you are using terminal:
  • terminal: iTerm2
  • $TERM variable: screen_256color
  • color configuration (:set t_Co?): set t_Co=256
    It happens both in vim and Neovim.

actual behavior

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

expected behavior

No error raised when vim opened.

Most helpful comment

@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?

All 16 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

notpratheek picture notpratheek  路  18Comments

ravicious picture ravicious  路  22Comments

a14m picture a14m  路  44Comments

Tomalak picture Tomalak  路  17Comments

svanharmelen picture svanharmelen  路  38Comments