A Visual Studio Code extension inspired by vim-sandwich that provides operations to add, delete, and replace surroundings like quotes (single ', double ", backtick `), brackets (parentheses (), braces {}, square brackets [], angle brackets <>), and HTML/XML tags.
This extension adapts the core concept of vim-sandwich to VSCode's editing environment. It is not a complete port or fully compatible implementation, but rather a VSCode-native approach to text surrounding operations.
-
Add surroundings to text objects
- Multiple selection modes:
_: Entire lines: Current selectionit: Inside HTML/XML tagsat: Around HTML/XML tags (including the tags)st: Self-closing tags
- Multiple selection modes:
The extension uses a command-based workflow:
- Trigger the extension (default:
Cmd-k + son macOS,Ctrl-k + son Windows/Linux) - Select operation:
a(add),d(delete), orr(replace) - Select target range (for add operation)
- Select surrounding type
1. Open VS Code
2. Go to Extensions (Cmd+Shift+X / Ctrl+Shift+X)
3. Search for "VSCode Sandwich"
4. Install
Or go to https://marketplace.visualstudio.com/items?itemName=sa2taka.vscode-sandwich.
The extension can be configured through VS Code settings:
"vscodeSandwich.enterToConfirm": false,
"vscodeSandwich.highlightColor": "rgba(255, 255, 0, 0.3)"Controls whether the extension requires pressing Enter to confirm each selection or responds immediately when a key is pressed:
false(default): The extension responds immediately when you press a key, without waiting for Enter. This allows for faster workflows but may lead to accidental selections if you press the wrong key.true: After selecting an operation (a/d/r) or range type, you need to press Enter to confirm and proceed to the next step. This is safer as it prevents accidental selections.
For example, with enterToConfirm: true, the workflow would be:
- Press
Cmd-k + s - Press
athenEnter - Press
sthenEnter - Press
"thenEnter
With enterToConfirm: false, the workflow would be:
- Press
Cmd-k + s - Press
a(immediately proceeds to next step) - Press
s(immediately proceeds to next step) - Press
"(immediately applies the operation)
Sets the color used for highlighting selected ranges. The default is "rgba(255, 255, 0, 0.3)" (semi-transparent yellow).
How to publish the extension. ref: https://code.visualstudio.com/api/working-with-extensions/publishing-extension
- Access Azure DevOps (https://dev.azure.com/{Your_Organization}) to get the PAT
- Update the version in package.json
- Run
vsce package <version> --no-dependencies - Run
vsce publish <version> --no-dependencies


