ludovicchabant/vim-gutentags

How do I use different tag files for different directories of a same workspace

rameshsanth opened this issue · 1 comments

The project I work is huge with plenty of directories & source files (C/C++/Python). My work involves a single module only on few files in a specific directory.
Currently gutentags is maintaining a single tags file in workspace root and updates it every time i modify files in a sub directory (my-module). As a result the ctags runs several gigs and takes a long time to finish, slowing down my vim experience.

I want gutentags to maintain the 2 tags file.

  • One in the workspace root that gets created just once
  • Second tags file for the directory I change the files (my-module). This file gets updated if i save files.

Can gutentags be configured to work like this ?

I can setup tags paths to include both tags file in vim.

Here is an example of the workspace I'm talking about.

workspace root
   + **tags**   << Update only once
   + linux / inc
   +         src
   +         .
   +         .
   +
   + mod1 / src
   + mod2 / src
   + my-module / inc
   +           src
   +           **tags**  <<< Update often when write to files

You could add some custom marker inside my-module, which you then add to g:gutentags_project_root. This would let gutentags treat your module as a separate project, and create a unique tag file for it. Alternatively you could define a custom project root finder (see g:gutentags_project_root_finder) that checks for your module, and calls gutentags#default_get_project_root as a fallback.

You might need some other custom tweaks to set tags to be both your module's tag file and the root workspace tag file -- by default, gutentags would only set one tag file per "project".