83374Re: Tags best-practices for multiple projects?
- Sep 30, 2007Mikael Jansson wrote:
> Hey Tony!"make tags" generates tags for the Vim project (which, on my machine, has its
>> 2) all tagfiles collected together: it might be easier to handle if each
>> tagfile is in the top directory for the corresponding project. This assumes
>> that each project has its own directory structure, separate from every other
>> project's. If you wish, you may add softlinks (if supported by your OS and
>> filesystem) from ~/.tags/project1 to (e.g.) ~/.build/project1/tags (Reminder:
>> every tagfile SHOULD be named "tags" if in Vim format, or "TAGS" if in Emacs
>> 3) auto-generated: see the "tags" target in src/Makefile in the Vim source for
>> an example.
> Not quite sure I understand what you mean by "automatic", here -- I
> looked in the Makefile but couldn't find much useful that relates to
> multiple-project tags. Then, I'm not very familiar with tags. I'd
> appreciate some hand-holding in this matter.
files at ~/.build/vim/vim71/ and below). You could have a similar target in
the makefiles for your other projects. If you want the tagfile regenerated in
some project whenever you invoke "make" without arguments, then you could have
a dependency for "tags" (or for some equivalent phony target) in the default
target (such as "all") defined in the makefile for that project. Or else run
"make tags" manually after running "make" or instead of it.
>yes, it's a matter of having the correct value in the 'tags' option. See
>> 4) with (2) above, ":cd <projectdir>" ought to be enough to have Vim find the
>> correct tagfile.
> I'd need for vim to scan for the tags file in parent directories
> successively until it reaches the root of my project directory and the
> tags file. Would that be doable?
":help file-searching" and scroll down to "2) Upward search".
meaning: search for "tags" in the current directory, and upward starting at
the directory of the current file. To limit the upward search, add a
"stop-directory" after the semicolon.
>Hm, why would you need the tagfiles from several projects at the same time?
> Moreover, I'd probably need the tags from >1 project (but still separate
> tags files!) -- can I make vim merge the inputted definitions and/or
> read >1 tags file? Or do I have to do it manually by defining all
> directories when creating the tags file, i.e. w/ ctags?
> - Mikael
Wouldn't you want to limit the search to the project you're currently working on?
From ":help tags-option" I seem to understand that all tagfiles in all dirs
specified (including upward dirs if specified) are searched until a matching
tag is found. What "matching" means in this context depends on the
'ignorecase' setting. You could e.g. use
if you have generated a tagfile there for your common include files.
To edit files from different projects in split-windows in a single Vim, then
(if the default option of searching from the current file's dir doesn't suit
you), remember that this option is |global-local| : you can use ":setlocal" to
set a different value for one buffer.
That period of life in which we compound for the vices that we
still cherish by reviling those that we no longer have the enterprise
-- Ambrose Bierce
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic Next post in topic >>