gd and gD in vim

发表于:2007-05-26来源:作者:点击数: 标签:
在阅读代码时,直接寻找某一变量的定义。 struct X x; void foo() { struct Y y; struct Z z; ... } For some reason you've forgotten what y and z are and want to go to their declaration double quick. One way of doing this is by searching backwar
在阅读代码时,直接寻找某一变量的定义。

struct X x;

void foo()
{
    struct Y y;
    struct Z z;

    ...
}

For some reason you've forgotten what y and z are and want to go to their declaration double quick. One way
of doing this is by searching backwards for y or z. VIM offers a simpler and quicker solution. The
gd keystroke stands for Goto Declaration. With the cursor on "y" if you hit gd the cursor will take you to the
declaration :− struct Y y;.
A similar keystroke is gD. This takes you to the global declaration of the variable under the cursor. So if one
want to go to the declaration of x, then all one needs to do is hit gD and the cursor will move to the
declaration of x.

原文转自:http://www.ltesting.net

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)