Find a global declaration in the current file
gD
Example
Normal 0 / 1Normal 1 / 1int count;
void example() {
int count;
count = 2;
}Cursor on line 4, column 3int count;
void example() {
int count;
count = 2;
}Cursor on line 1, column 5Find a global declaration in the current file.
Found the declaration by searching from line 1.
Before & after
int count;
void example() {
int count;
count = 2;
}Cursor on line 4, column 3int count;
void example() {
int count;
count = 2;
}Cursor on line 1, column 5Start 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.