Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Allow tags jumping with no need to open the tags panel first #845

Open
pidgeon777 opened this issue Feb 2, 2023 · 5 comments
Open

Comments

@pidgeon777
Copy link

Currently, to use the TagbarJumpNext and TagbarJumpPrev 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.

@raven42
Copy link
Collaborator

raven42 commented Feb 23, 2023

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.

@pidgeon777
Copy link
Author

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

@raven42
Copy link
Collaborator

raven42 commented Feb 23, 2023

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.

@pidgeon777
Copy link
Author

pidgeon777 commented Feb 23, 2023

I'm using Neovim version v0.8.3 stable.

@raven42
Copy link
Collaborator

raven42 commented Feb 23, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants