vim-gutentags
vim-gutentags copied to clipboard
please support the usage of `vim -t symbol`
hi,
please support the usage of vim -t symbol
, some people are used to it.
For now when I use this pattern, I get
so I check the ctag database, and the new tag file generated by gutentags(not in current dir) was not there
I've found a workaround for this from here. You can add this to your .vimrc
: execute 'set tags+='.substitute(glob(g:gutentags_cache_dir .. '/*tags'), "\n", ',', 'g')
.
This would add every tags file ending with tags
in your gutentags_cache_dir
to the tags
variable. Unfortunately, this would remove the feature of only adding the tags file for the current project, but this issue would have to be fixed within the script itself.
this works, thanks @jdholtz
Right now gutentags tries to stay out of the way until it's needed, i.e. when you open a file that belongs to a project that needs tag support. Supporting the -t
argument would require gutentags to always initialize and scan stuff on startup -- I don't see any obvious way to figure that -t
was passed (surprisingly enough, argc()
and argv()
come out empty for that...). I'm not ready to refactor the plugin to work that way, but it's worth keeping in mind.
You can find if -t
is passed as a flag by doing match(v:argv, '^-t') >= 0
.
However, when I tried implementing this, the tags variable gets set correctly, but it seems like vim searches for the tag before the plugin has initialized, because the tag is still not found (even though doing :tag {tag} in the buffer does work).
Let me know if you have any solutions to this (unless this is what you mean by not wanting to initialize the tags unless it is necessary) and I can submit a PR for it.
I am myself a user of vim -t
and it works just fine with gutentags and I guess the reason is because I use this option ? :
let g:gutentags_project_root = ['Makefile']
I always have a tags
file at the root of my project and it works well
@cassepipe this problem occurs when the tags file is not in the current directory that vim -t
is executed in (when using theg:gutentags_cache_dir
option to store tags elsewhere besides the project root)
So the problem comes from vim
not being able to find tags with the -t option when the tags
file is not
in the current directory, right ?
What about changing g:gutentags_cache_dir
to the current directory ?
Yes, but many people want their tags stored in a certain directory, not the project root. Users shouldn’t be limited on how they can use this plugin if they want to use the -t
flag with vim.
Hey @ludovicchabant, any updates after my comment here ?