无法转到参考线

Cannot go to the line of the reference

我最近安装了 cscope Vim 插件,以便更轻松地跳转代码,但主要功能 - 转到行,不起作用。 我将 F2 键映射到 "Find all references"。例如,当我 select 一个函数调用并按 F2 时,我得到所有引用的列表,第一个引用通常是函数定义。当我输入行号并按 Enter 时,没有任何反应,它应该跳转到我输入的行。这里可能是什么问题?我是否需要对我的 vimrc 文件进行一些额外的更改才能使跳跃成为可能?

When I type the line number and press Enter, nothing happens, and it is supposed to jump to the line I typed in

您实际上应该键入第一列中显示的数字。 :help cscope-commands 中详细解释了 cscope 的用法。它还提供了以下示例:

    :cscope find 0 DEFAULT_TERM

    Executing this example on the source code for Vim 5.1 produces the
    following output:

    Cscope tag: DEFAULT_TERM
       #   line  filename / context / line
       1   1009  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"amiga"
       2   1013  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"win32"
       3   1017  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"pcterm"
       4   1021  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"ansi"
       5   1025  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"vt52"
       6   1029  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"os2ansi"
       7   1033  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"ansi"
       8   1037  vim-5.1-gtk/src/term.c <<GLOBAL>>
         # undef DEFAULT_TERM
       9   1038  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"beos-ansi"
      10   1042  vim-5.1-gtk/src/term.c <<GLOBAL>>
         #define DEFAULT_TERM (char_u *)"mac-ansi"
      11   1335  vim-5.1-gtk/src/term.c <<set_termname>>
         term = DEFAULT_TERM;
      12   1459  vim-5.1-gtk/src/term.c <<set_termname>>
         if (STRCMP(term, DEFAULT_TERM))
      13   1826  vim-5.1-gtk/src/term.c <<termcapinit>>
         term = DEFAULT_TERM;
      14   1833  vim-5.1-gtk/src/term.c <<termcapinit>>
         term = DEFAULT_TERM;
      15   3635  vim-5.1-gtk/src/term.c <<update_tcap>>
         p = find_builtin_term(DEFAULT_TERM);
    Enter nr of choice (<CR> to abort):

    The output shows several pieces of information:
    1. The tag number (there are 15 in this example).
    2. The line number where the tag occurs.
    3. The filename where the tag occurs.
    4. The context of the tag (e.g., global, or the function name).
    5. The line from the file itself.

您应该输入一个介于 1 和 15 之间的数字;任何其他只需取消命令。