ctags, generate tags using multiple paths?
Asked Answered
S

1

6

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?

Stated answered 23/10, 2013 at 22:10 Comment(3)
Did you read $ man ctags before asking? If so, did you try something? If so, what worked? What failed? If not, do you at least have a theory?Sublet
I did. I understand that I can provide a file with paths to directories, but that means that I would have to hardcode all of my paths in (right?), which I dont want to do. I want one hardcoded path, and the rest to be based off my current directory.Stated
Actually, I think I could just generate tags in the "other" directory manually, they're mostly windows headers and junk so they'll rarely need to be updated, then I could do a set ctags+= /path/to/other/dir, to include another tag file. hooray.Stated
H
11

When the files in the other directory are related and often change together with the current directory hierarchy, I'd write a custom :Ctags command that supplies the other path to the :!ctags call.

If the other files are unrelated, and rarely update (as based on your comments seems to be the case), I'd run ctags there separately and include them via

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

ctags -f my_tags -R
:set tags+=/path/to/other/dir/my_tags
Housel answered 24/10, 2013 at 6:51 Comment(1)
This is great advice. As a follow up, can you do something similar for cscope?Quagga

© 2022 - 2024 — McMap. All rights reserved.