Open pidgeon777 opened 1 year ago
This can be done a little bit indirectly. The reason it is not working for you without opening the tagbar window is because the file has not yet been scanned for tags. This is actually an optimization that is in the plugin to avoid using extra resources if not in use. I.E. there is no reason to load the tags for a file unless you open the tagbar window or are using the tags.
To trigger a call to scan the file for tags, you can add the following to your .vimrc somewhere after the file has loaded.
call tagbar#Update()
This should trigger scanning the file for tags, and thus the :TagbarJumpNext
/ :TagbarJumpPrev
command should work.
call tagbar#Update()
leads to an error:
Errore/i eseguendo function tagbar#Update[1]..<SNR>104_AutoUpdate[38]..<SNR>104_IsValidFile:
riga 29:
E121: Undefined variable: s:known_types
E116: Argomenti non validi per la funzione: has_key
Hmm... are you by chance using vim 9? I've seen a similar error on a test setup with vim 9 that I have that I haven't been able to really track down yet. From what I can tell it seems to be something with vim 9 doing the initial load a little differently than vim 8, where calling a tagbar function inside the .vimrc causes a similar error, but once vim is fully loaded, then calling the same function seems to work just fine.
I'm using Neovim version v0.8.3 stable.
hm. Ok. could be something similar. I'll try to dig into it more and see if I can figure anything out. But as of now, that is about the only way I can think of to automatically have the :TagbarJump...
commands work.
Currently, to use the
TagbarJumpNext
andTagbarJumpPrev
commands, you need to open the tagbar panel first.It would be great to allow jumping to the next/previous tag without opening the tagbar panel first, eventually by setting a custom option to enable this behaviour.