Search code examples
visual-studio-codequarto

VS Code shortcut to add delimiters to selected words


I am using quarto on VS Code, and need a keyboard shortcut to add delimiters to a selected word or words. For instance, considering the words

thank you

the keyboard shortcut should return

`thank you`


Solution

  • define the following key binding

    {
      "key": "ctrl+k ctrl+i",  // or any other combo
      "command": "editor.action.insertSnippet",
      "when": "editorTextFocus",
      "args": {
        "snippet": "`${TM_SELECTED_TEXT}`$0"
      }
    }
    

    Select the text and press key binding.