Search code examples
visual-studio-codemarkdown

Keyboard shortcut in VSCode for Markdown links?


from other text editors I'm used to adding Markdown links by

  1. selecting the word I want to be linked,
  2. pressing cmd-K on my Mac's / iPad Pro's keyboard, which puts square brackets around the marked word, appends a pair of normal parenthesis () and places the cursor right in beetween those two parenthesis so that I can
  3. just paste the URL I have in my clipboard into the right place by pressing cmd-V.

So, select -> cmd-K -> cmd-V is a nice and short sequence for adding links in a Markdown document and cmd-K has become some kind of pseudo standard for adding links in several writing apps.

However, in VSCode that's not possible. But I'd love to make it possible. Any ideas? cmd-K is (hard-wired?) bound to listen for a next key press. But it doesn't have to be cmd-K. I can learn another keystroke. But I need to be able to put additional text (square brackets and parenthesis) into the text and move the cursor to the right position. How's that done?

Thanks so much!


Solution

  • The latest release of VSCode in January 2024 (1.86.0) now supports this as a standard feature. See the release notes:

    Want to turn that link you copied into a Markdown link? When you paste a URL into a Markdown file with text selected, VS Code now automatically inserts a Markdown link

    vscode markdown link paste feature demo