vim ctags,两个相同的条目,不会直接跳转到定义
vim ctags, two same entries, won't jump to definition directly
我用ctags -R .
生成标签,
如果我在某些功能上尝试 ctrl ]
,我总是会得到两个相同的条目
# 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):
我必须输入 1 或 2 才能跳转到定义。
如何让VIM直接跳转?
更新 1:
好像是我环境的问题
所以我有一个安装了 VirtualBox 的 Mac 主机,我有一个 CentOS 客户机。
我在CentOS环境下开发。
并且我在 Mac 和 CentOS 之间创建了一个共享文件夹:
[Mac]/Users/sato/Dropbox/projects/asdf => [Centos] /home/sato/asdf
和src/connection.c在/home/sato/asdf
如果我将 asdf 复制到 /home/sato/fdsa,则 vim 中的 ctrl ]
有效
您可以为命令提供 count,即 1<C-]>
,但这只是一种解决方法。
解决此问题的正确方法是避免在标签数据库中出现两个相同的条目。从您的输出中,无法判断是什么原因造成的。我过去遇到过这种情况,当时有备份文件(具有不同的文件扩展名),或者如果我 运行 ctags
在层次结构中太高的目录上,所以不同版本的包含相同的库。
我用ctags -R .
生成标签,
如果我在某些功能上尝试 ctrl ]
,我总是会得到两个相同的条目
# 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):
我必须输入 1 或 2 才能跳转到定义。
如何让VIM直接跳转?
更新 1:
好像是我环境的问题
所以我有一个安装了 VirtualBox 的 Mac 主机,我有一个 CentOS 客户机。 我在CentOS环境下开发。
并且我在 Mac 和 CentOS 之间创建了一个共享文件夹:
[Mac]/Users/sato/Dropbox/projects/asdf => [Centos] /home/sato/asdf
和src/connection.c在/home/sato/asdf
如果我将 asdf 复制到 /home/sato/fdsa,则 vim 中的 ctrl ]
有效
您可以为命令提供 count,即 1<C-]>
,但这只是一种解决方法。
解决此问题的正确方法是避免在标签数据库中出现两个相同的条目。从您的输出中,无法判断是什么原因造成的。我过去遇到过这种情况,当时有备份文件(具有不同的文件扩展名),或者如果我 运行 ctags
在层次结构中太高的目录上,所以不同版本的包含相同的库。