----- Original Message -----
From: "Bram Moolenaar" <[EMAIL PROTECTED]>
To: "Jason Aeschilman" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Saturday, April 08, 2006 5:00 AM
Subject: Re: Duplicate tags problem
Jason Aeschilman wrote:
I have a problem with duplicate tags. It seems that somewhere between
6.2.457-1 and 6.3.54 (which I recently upgrade to), the duplicate tag
behavior changed. It used to be that if I used ctrl-] on a function name
that it would look at the tags file in the current directory and if a match
was found it would jump to the function, but if a match wasn't found it
would check the tags file one directory up and if a match was found it would
jump to the function. Now it seems that in 6.3.54 it looks at both the tags
file in current directory and the tags file up one directory and returns all
the found matches even if they really point to the same file.
For example, if I have a directory layout like so:
~/code
~/code/module
~/code/include
~/code/common
I would run "ctags -R" in directory "code" and in each subdirectory.
Then in my .vimrc I have: set tags=./tags,./../tags
This way I could jump to a function reference no matter whether it was found
in a file in the current directory (let's say I'm in ~/code/module) or if it
was found in another directory (~/code/include).
Darren Hiebert (ctags creator) outlines a better strategy for doing this, which I've been using for a while now. I wrote a bash
script to run both ctags and cscope on a directory structure in the manner he outlines.
The basic idea is that you run ctags -R only in the base directory of a project structure, and you run it with the --no-static
option (name could be wrong, but it's something like that) so that static identifiers in subdirectory files are not included. Thus,
the tags file in the base directory contains only "global" tags. Then, you run ctags (*non-recursively* - i.e., no "-R") in each
subdirectory. Finally, you set the 'tags' option in Vim to something like './tags,tags' so that if you're editing a file in a
subdirectory, Vim will first look in the "local" tags file in that subdirectory ('./tags'), and will look in the base directory's
"global" tags file ('tags') only if it's not found in the local tags file. Note that in the example you gave above, this is where it
would find the identifier in ~/code/include, provided that it was a global (non-static) identifer.
I think your problem is that you're running ctags with -R in both the base and the sub directories. This means the same tags will be
listed in multiple tags files, which may both be searched, depending upon the current setting of the 'tags' option. Perhaps your
'tags' setting changed when you upgraded Vim?
Let me know if you need a link to Darren Hiebert's page or any other
information...
Hope it helps,
Brett Stahlman
If the function was found in a file in the current directory it used to be
that it would just jump to it without giving me a list of matches. Now it
gives me a list of matches based on what is in the current tags file and the
tags file up a level. Like so:
# pri kind tag file
1 F f config_load config.c
int config_load(const char *fname)
2 F f config_load /home/jason/code/module/config.c
int config_load(const char *fname)
This is the same file! The first entry is from the current directory tags
file and the second entry is from the upper level tags file. I want it so
if a match is found in the current directory tags file to just use that. It
worked this way before upgrading to 6.3.54 and I would like this behavior
back.
I've looked at the help and I've been unable to find an option to enable the
old behavior. Does anyone know how I can get this old behavior back without
having to downgrade to 6.2.457.1?
First of all, it's recommended to upgrade to Vim 6.4. It includes many
bugfixes.
But that doesn't solve this specific problem. I'll look into it.
--
How To Keep A Healthy Level Of Insanity:
6. In the memo field of all your checks, write "for sexual favors".
/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://www.ICCF.nl ///