Reputation: 8602
I use ctags -R .
to generate tags,
if I try ctrl ]
on some function, I always get two same entries
# pri kind tag file
1 F f accept_the_connection src/connection.c
int accept_the_connection(connection *conn)
2 F f accept_the_connection src/connection.c
int accept_the_connection(connection *conn)
Type number and <Enter> (empty cancels):
I have to type 1 or 2 to jump to the definition.
How to make VIM jump directly?
UPDATE 1:
It seems to be a problem of my environment
So I have a Mac host with VirtualBox installed, and I have a CentOS guest. I develop in the CentOS env.
And I created a shared folder between Mac and CentOS:
[Mac]/Users/sato/Dropbox/projects/asdf => [Centos] /home/sato/asdf
and src/connection.c is in /home/sato/asdf
if I copy asdf to /home/sato/fdsa then ctrl ]
in vim works
Upvotes: 0
Views: 571
Reputation: 172598
You can supply a count to the command, i.e. 1<C-]>
, but that's only a workaround.
The right way to fix this is to avoid having two identical entries in the tags database. From your output, it's impossible to tell what caused this. I have encountered this in the past when there were backup files (which had a different file extension), or if I ran the ctags
on a directory too high up in the hierarchy, so different versions of the same library were included.
Upvotes: 1