gd will take you to the local declaration.
gDwill take you to the global declaration.
g* search for the word under the cursor(like *
, but g*
on 'rain' will find words like 'rainbow').
g#
same as g* but in backward direction.
gg
goes to the first line in the buffer (or provide a count before the command for a specific line).
G
goes to the last line (or provide a count before the command for a specific line).
gf
will go to the file under the cursor(ctl+o返回)
g]
and other commands will jump to a tag definition (a tag can be a function or variable name, or more).
使用gd/gD命令可以跳转到一个函数的声明处,但是无法跳转到函数的定义出。如果想要跳转到一个函数的定义出(go to definition),可以使用Ctags工具。vim中默认已经安装了Ctags。具体使用见下面的链接