Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify where to generate the tags file

I currently have a project directory like this

MainProject
|_ProjectA
|   |_src
|      |_file1.cpp
|      |_file2.cpp
|      |_.....
|      |_tags <---tag file generated here  
|_ProjectB
|   |_src
|      |_file3.cpp
|      |_file4.cpp
|      |_.....
       |_tags <---tag file generated here

Now file4.cpp uses items in file1.cpp however it seems that since its in a different folder I get the message

cstag - tag not found

Currently i went into my ProjectA and ProjectB and did this for each

ctage -R .

as a result of which tags file got generated in each project. My question is how can I specify where to generate the tags file. In that case all the tags file will be next to each other and hopefully that will solve this problem

like image 552
James Franco Avatar asked Jul 23 '17 08:07

James Franco


People also ask

How do I create a folder in tags?

To create a new folder, click New Folder. To place one or more tags, triggers, or variables into a folder, select their checkboxes in the list and then select a folder from the Move menu to place the items in an existing folder.

Where are ctags stored?

Ctags is a tool that will sift through your code, indexing methods, classes, variables, and other identifiers, storing the index in a tags file.


1 Answers

The simplest solution would be to generate a single tags file:

$ cd MainProject
$ ctags -R .

and tell Vim to recurse upward when looking for tags files:

set tags=./tags;,tags;
like image 60
romainl Avatar answered Oct 06 '22 00:10

romainl