4 ms·
Have the following file: int foo () { return 3; } int bar() { return foo(); } put your cursor somewhere on the "foo"
by aidenn0 4y ago
Have the following file:
int foo ()
{
return 3;
}
int bar()
{
return foo();
}
put your cursor somewhere on the "foo" identifier in the second to last line and type "gD" (without the quotes). It should jump to the definition of foo. It's not perfect but works for much code without crazy preprocessor stuff. By default it's file-local, but you can give vim a list of include files to search as well.
- coffeeblack 4y agoAh, upper case D, yep that works! Thanks!
- aidenn0 4y agoyeah lower-case "d" is for local definitions (it just searches for the first appearance in the "[[" region if you are familiar with vim motions).