vim-gutentags icon indicating copy to clipboard operation
vim-gutentags copied to clipboard

Generating tags for a project with multiple git repos

Open gtcooke94 opened this issue 6 years ago • 3 comments

I have a project with multiple git repos stored flat (say, all of them are under ~/project_name/). I've been struggling for a few hours trying to figure out how to generate a tag file for this project, rather than for each individual git repo, because I want to be able to jump around between all of the repos in the project. I thought this would be an easy google, but I've struggled to find a solution via google or as an issue on github.

I'm using universal-ctags and gutentags in neovim. I'm also using vim-fugitive, which from some googling appears to affect tag generation?

What I thought would work was adding a folder like .custom_root_folder to g:gutentags_project_root, then creating this folder in ~/project_name, but that didn't work like I thought it would, and the tag files are still getting generated at the same level as all of my .git folders in the individual repos. Is there any way to get around this?

gtcooke94 avatar Mar 12 '19 15:03 gtcooke94

Gutentags walks up the directory hierarchy and, at each step, checks if any root marker is present. So it will find the .git directory first, always.

What you'll have to do is not just add a custom root marker (it can be a file, btw, not just a directory), but you'll have to remove .git from the list. You can do that by setting g:gutentags_add_default_project_roots to 0 (so it doesn't add the default markers).

ludovicchabant avatar Mar 13 '19 04:03 ludovicchabant

Ok, that makes sense - is there any way to have this set on a per-project basis? In general, I would like it to find .git directories and create tags for them, but in this specific project I want to create tags altogether for multiple git repos. If this is not possible via gutentags, it seems that something like this might work https://github.com/LucHermitte/local_vimrc? Override the g:gutentags_add_default_project_roots just in certain directories?

Thanks for your help!

gtcooke94 avatar Mar 13 '19 14:03 gtcooke94

I don't think you need to use local configs -- check out g:gutentags_project_root_finder. You can set that to a custom function that will find your project's root using whatever custom logic you want... so you can try to find you custom marker first before finding .git and other stuff.

ludovicchabant avatar Mar 14 '19 04:03 ludovicchabant