| 在阅读代码时,直接寻找某一变量的定义。 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.
|