vimctags

ctags, generate tags using multiple paths?


When I build/update my tags file, ctags starts at the current directory and works its way down recursively.

I would like for it to also include a completely different search path, a mapped network drive, and add those results to my tags file as well.

Is there any way to do that?


Solution

  • In vim, one can do like below to include the tags file from other directories as well.

    :set tags+=/path/to/other/dir/tags
    

    NOTE: Add the tag filename at the end, else there will be "tag not found" error. By default the name is tags but it could be renamed with -f option as below to my_tags when generating it in cli.

    $ ctags -f my_tags -R
    

    Now, in vim do

    :set tags+=/path/to/other/dir/my_tags
    

    where my_tags is the name of the tag file.

    This way any number of tags file can be updated within vim to access them through Ctrl + ] or :tag fnName or similar.