One of the best hidden π that I found on VSCode is the HTML wrapper combined with Emmet and together are pure gold.
I can believe all the time I've lost doing the same manually when forgot/need to include a parent tag.
The hard way π
Creating a new element and then move the content inside with cut/paste
or moving the lines with alt+verticalArrows
.
The good way π
Using the "Emmet Wrapper" option through the "Command Palette" using ctrl+shift+p
.
The best way π
Adding a shortcut alt+shift+w
for the "Emmet Wrapper" option.
You also can define the shortcut manually.
# π File: keybindings.json
-----------------------------------
// Place your key bindings in this file to override the defaults
[
// Emmet
{
"key": "alt+shift+w", //wrap emmet
"command": "editor.emmet.action.wrapWithAbbreviation",
"when": "editorHasSelection"
},
]
The Geek Way π€
What if I tell you, that the whole process can be faster without using the mouse adding more useful shortcuts.
# π File: keybindings.json
-----------------------------------
// Place your key bindings in this file to override the defaults
[
{
"key": "alt+shift+j", //expand selection
"command": "editor.emmet.action.balanceOut"
},
{
"key": "alt+shift+k", //contact selection
"command": "editor.emmet.action.balanceIn"
},
]
Multicursor π
But the magic does not end, this wrapper is also available for multicursor.
You don't need that extension π«
By the way, you don't need an extension like html-tag-wrapper to achieve it.
Thatβs All Folks!
Happy Coding π
Top comments (0)