Keybinding for wrapping html tags in VSCode

Is there a default key binding in VSCode to wrap a selection in an HTML tag, for example, the keyboard shortcut Shift + alt + W in Visual Studio 2015? I could not find anything like this in the documentation or in the default shortcut keys that indicate its availability from the box.

+12
keyboard-shortcuts key-bindings visual-studio-code
source share
3 answers

To automate this, go to.

File> Preferences> Keyboard Shortcuts

and add this to your keybindings.json (right window)

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

You can replace Ctrl + Shift + Enter with your own keyboard shortcut.

+39
source share

You can use this extension: https://github.com/Microsoft/vscode-htmltagwrap

or you can:

  1. open the command palette: Command / Control + Shift + P (โ‡งโŒ˜P)
  2. type "wrap", then select "Wrap with abbreviation"
  3. enter the desired tag and press enter
+5
source share

Or just find the HTMLtagwrap extension in VScode, make a choice. Then use Alt + W. Then enter the new tag.

0
source share

All Articles