代码之家  ›  专栏  ›  技术社区  ›  Sato

vim CTAG是两个相同的条目,不会直接跳转到定义

  •  0
  • Sato  · 技术社区  · 8 年前

    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才能跳转到定义。

    更新1:

    这似乎是我的环境问题

    所以我有一个安装了VirtualBox的Mac主机,还有一个CentOS guest。

    [Mac]/Users/sato/Dropbox/projects/asdf => [Centos] /home/sato/asdf
    

    和src/连接。c在/home/sato/asdf中

    在vim工厂

    1 回复  |  直到 8 年前
        1
  •  1
  •   Ingo Karkat    8 年前

    您可以提供 计数 命令,即。 1<C-]> ,但这只是一种变通方法。

    解决这个问题的正确方法是避免在标记数据库中有两个相同的条目。从你的输出来看,不可能知道是什么导致了这种情况。我在过去遇到过这种情况,当时有备份文件(具有不同的文件扩展名),或者如果我运行 ctags 在层次结构中位置过高的目录中,因此包含同一库的不同版本。

    推荐文章