Ryan Schachte's Blog
Jump to comments
Easy Markdown link generation with VIM & VSCode March 4th, 2024

I wanted a simple workflow to quickly convert text to links in VIM as I use the VIM extension in VSCode. Type CMD + Shift + P and enter Open Keyboard Shortcuts (JSON). From here, we can define a simple rule.

keybindings.json
[
  {
    "key": "cmd+l",
    "command": "editor.action.insertSnippet",
    "args": {
      "snippet": "[$TM_SELECTED_TEXT](${CLIPBOARD})"
    },
    "when": "editorTextFocus"
  }
]

Now I can simply:

  1. <cmd> + d to highlight the word using VIM
  2. <cmd> + l to turn selection into a Markdown link while auto-copying the clipboard value into the parenthesis.

Care to comment? click to expand
Author: Ryan Schachte Published: 2024-03-04