1: 345 my_func (int var)
2: 4523 my_func (int var)
3: 10032 my_func (3);
我曾经遇到过同样的问题,通过整合之前的答案并进行实验,我得出了这个解决方案:
[I // gives list of matches for word under cursor, potentially some matches are in headers. remember the number of the match you're interested in, eg. the 3rd
q // quits the list of matches
3[Ctrl-i // (with cursor in same position) jumps to third match
在vim中输入:h tselect可以查看完整定义
如果您已经看到要使用的标签,可以键入“q”并输入数字。
1: 345 my_func (int var)
2: 4523 my_func (int var)
3: 10032 my_func (3);
[I
仅列出搜索结果。要跳转到结果,请使用序列 [CTRL+I]
。
您可以在以下位置查看相关跳转的完整列表:
当我使用vim时,我通过执行以下操作跳转到标签:
:tag getfirst
我看到的东西长这样:
# pri kind tag file
1 F m getfirst /home/sthorne/work/.../FormData.py
class:FakeFieldStorage
def getfirst(self, k, default):
....
8 F m getfirst /home/sthorne/work/.../CGIForm.py
class:CGIForm
def getfirst(self, name):
Choice number (<Enter> cancels):
我输入'5'来跳转到第五个出现的位置。
如果你的vim没有这种行为(我的vim似乎默认就有这种行为), 你可以使用g]代替ctrl-], 这类似于使用:tselect代替:tag
尝试使用123G
跳转到第123行(参见:h G
)。