Quick text selection sidekick
Quickly select text inside or outside the closest/innermost pair of quotes (' " `) or brackets (<> {} [] ()), and switch quote styles — all from the keyboard.
Commands & default keybindings
In the Command Palette every command is listed under the PK Smart Selection category — type pk to see them all.
| Command |
Windows/Linux |
macOS |
| Select Inside Quote |
Ctrl+' |
Cmd+' |
| Select Outside Quote |
Ctrl+Shift+' |
Cmd+Shift+' |
Switch Quote Style (' → " → ` → …) |
Ctrl+Alt+' |
Cmd+Alt+' |
| Select Inside Bracket |
Ctrl+9 |
Cmd+9 |
| Select Outside Bracket |
Ctrl+Shift+9 |
Cmd+Shift+9 |
| Select Inside Quote or Bracket (innermost of either) |
Alt+' |
Alt+' |
| Select Outside Quote or Bracket (innermost of either) |
Alt+Shift+' |
Alt+Shift+' |
| Shrink Selection (step back one select/expand) |
Ctrl+Alt+9 |
Cmd+Alt+9 |
Behavior
- Inside selects between the delimiters; Outside includes them.
- The innermost pair enclosing the cursor wins; with no enclosing pair, the nearest pair on the line is used (forward first).
- Press again to expand to the next enclosing pair:
f(a, g(b|, c), d) → (b, c) → (a, g(b, c), d).
- Shrink Selection steps back through the select/expand history one step at a time. Moving the cursor by any other means (mouse, arrow keys, typing) clears the history.
- Switch Quote Style re-escapes as needed (
'it\'s' → "it's") in a single undo step.
- All commands support multiple cursors (each cursor independently).
- Escaped quotes (
\') are never delimiters; angled brackets use heuristics so a < b is not a pair but List<Dict<str, int>> is (enabled per language, see settings).
Customizing keybindings
All commands are standard VS Code commands — remap them in File → Preferences → Keyboard Shortcuts, or in keybindings.json:
{ "key": "alt+b", "command": "smartSelection.selectInsideBracket", "when": "editorTextFocus" },
{ "key": "ctrl+9", "command": "-smartSelection.selectInsideBracket" } // remove default
Settings
| Setting | Default | Description |
|---|---|---|
| smartSelection.quoteCharacters | ["'", "\"", ""]| Characters treated as quotes | |smartSelection.switchQuoteCycle|["'", """, ""] | Cycle order for Switch Quote Style |
| smartSelection.multiLineStrings | true | Back-tick strings may span lines |
| smartSelection.angleBrackets | "auto" | <...> matching: auto / always / never |
| smartSelection.angleBracketLanguages | TS, C#, C++, Java, Rust, HTML, … | Languages where auto enables <...> |
| smartSelection.expandOnRepeat | true | Repeat invocation expands outward |
| smartSelection.showNoMatchHint | false | Status-bar hint when nothing matches |
| smartSelection.ignoreDelimitersInComments | true | Skip brackets inside strings/line comments |
Known limitations (v1)
- String/comment detection is heuristic (no language-server tokens); block comments are not masked.
- HTML tag pairs (
<div>…</div>) are not treated as a unit — only the tag delimiters themselves match.