ludovicchabant / vim-gutentags

A Vim plugin that manages your tag files
https://bolt80.com/gutentags/
MIT License
2.3k stars 175 forks source link

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

Open rameshsanth opened 1 year ago

rameshsanth commented 1 year ago

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.

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
ludovicchabant commented 1 year ago

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".