I use coc.vim heavily and am a big fan of gD to go to a definition.

Two questions:

  • Is gD idiomatic vim, or more a coc thing?
  • When I have links in markdown files to URLs, it feels natural to me to use gD to want to open them (I think this is like the "Command + Click" in a graphical editor - but is there a more 'vim' way that keeps this flow?

Example case is I have a README file that has links to some further docs, I'm just curious to open the links without leaving the keyboard. I could yank the contents of the link, use !open C^R but it feels less intuitive.

Thanks in advance!

1 Answer 1


First off, both the native :help gd and the native :help gD are "go to declaration", not "go to definition". The difference may or may not be meaningful to you but that is a first level of removal from the original commands.

Then you have the fact that both commands are constrained to the current buffer: gd is local to the current "block" (whatever that means) and gD covers the whole buffer. Jumping to another file is a second level of removal.

Then you have a third level of removal: opening the filename or URL under the cursor has nothing to do with the original "go to declaration" and is covered "natively" by separate commands: :help gf for files and :help gx for URLs.

The last level of removal is reached by lumping together unrelated functionalities into a single command, which goes against Vim's whole design.

Now, users and plugin developers are 100% free to override whatever command they want and deviate however they want from the core model but, IMO, that is going a little bit too far.

Anecdotally, I interacted a few times with CoC users who were super confused about gd. Some copied the example config from the README.md without even reading it and wondered why gd suddenly changed. Some only knew about CoC's gd and had no idea a built-in gd existed, which led to very frustrating discussions where the two parties talked about different things. Etc. There is a cost to that, that plugin authors often brush off because they are not the ones providing support for their own plugins.

  • Thank-you this is perfect - I will make gf and gx part of my day to day routine, as these are built in. This is really what I was looking for - the more pure vim way of handling this, avoiding plugins. Really appreciate the quick answer @romanl
    – Dave Kerr
    Commented Jun 16, 2023 at 6:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.