Vim Recall繁體中文

Find a global declaration in the current file

gD

Example

Normal 0 / 1
int count;
void example() {
  int count;
  count = 2;
}
Cursor on line 4, column 3

Find a global declaration in the current file.

Before & after
Before
int count;
void example() {
  int count;
  count = 2;
}
Cursor on line 4, column 3
After
int count;
void example() {
  int count;
  count = 2;
}
Cursor on line 1, column 5

Start in Normal mode. A C-like buffer contains a global declaration and a nearer local declaration of count.

Details & Vim help

Example replayed in Vim

gD searches for the word under the cursor from line 1 of the current file. The heuristic was designed for finding C declarations.