craftplacer.moe MeBlogDiaryCookbookThings people say about meAbout me FavoritesExtensionsMusic World Wide WebDirectoryServices ProjectsKaitekiContributionsWeb designPleroma styles Guestbook

Wrap text with a HTML tag inside Visual Studio Code using Emmet

From: How to do tag wrapping in VS code?

There’s a command called “Emmet: Wrap with Abbreviation”, which allows typing in an Emmet abbreviation to add HTML tags around text.

This can be turned into a keyboard shortcut:

{
    "key": "ctrl+shift+9",
    "command": "editor.emmet.action.wrapWithAbbreviation",
    "when": "editorHasSelection",
    "args": {
        "abbreviation": "span",
    },
},

This section can be pasted into Visual Studio Code’s keyboard shortcuts config, you can open it by executing Preferences: Open Keyboard Shortcuts (JSON)