Search code examples
keyboard-shortcutsvisual-studio-codekey-bindings

Key binding to wrap a selection with an html tag in VSCode


Is there a default key binding in VSCode to wrap a selection in an HTML tag like the keyboard shortcut Shift+alt+W in Visual studio 2015? I could not find anything similar in documentation or in the default keyboard shortcuts that indicates its availability out of the box.


Solution

  • To automate this go to.

    File > Preferences > Keyboard Shortcuts

    and add this into your keybindings.json (right hand side window)

    {
        "key": "ctrl+shift+enter",
        "command": "editor.emmet.action.wrapWithAbbreviation",
        "when": "editorTextFocus && !editorReadonly"
    }
    

    You can replace ctrl+shift+enter with your own key combination.