3 ms·
:gd E492: Not an editor command: gd VIM 8.2 Do I have to activate it somehow? :)
by coffeeblack 4y ago
:gd
E492: Not an editor command: gd
VIM 8.2
Do I have to activate it somehow? :)
- aidenn0 4y agoHave 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).
- falcolas 4y agoWhat aidenn0 said. Specifically it's one of the 'g' commands (like gg which goes to the top of the file and gG goes to the bottom). Just put your cursor on an identifier and gD (goto definition is the mnenomic). :help g