🚀 Smart Multi-Cursor Paste
Bring WebStorm's intuitive multi-cursor paste behavior directly into VS Code! ✨
🛑 The Problem
In WebStorm, if you copy 4 selections (using 4 cursors) and paste them using 3 cursors, the first 3 items are pasted neatly — exactly one per cursor.
In vanilla VS Code, doing the same thing pastes all 4 items at every single one of the 3 cursors, leaving you with a messy duplication to clean up.
The opposite direction is just as annoying: copy 3 items and paste at 4 cursors, and VS Code dumps all 3 items at each of the 4 cursors — 12 items instead of 3! 😱
✨ How It Works
This extension fixes the mismatch by replacing the default copy/cut/paste commands with smart, context-aware alternatives.
- ⌨️ Smart Keybindings: Rebinds
Ctrl/Cmd+C, Ctrl/Cmd+X, and Ctrl/Cmd+V in the editor to track how many cursors were active during the copy. Everything else is safely delegated to VS Code's built-in clipboard commands.
⬇️ Fewer cursors than copied items (e.g. 4 copied → 3 cursors)
Controlled by the smartPaste.mismatchBehavior setting:
- 🎯
pasteFirstN (Default) — The WebStorm way: pastes the first cursor-count items, one per cursor, in document order.
- 🔁
vscodeDefault — The standard VS Code way: pastes the entire copied text block at each destination cursor.
- 🤔
ask — Shows a lightweight quick-pick menu (similar to the Quick Fix menu) letting you choose on the fly.
⬆️ More cursors than copied items (e.g. 3 copied → 4 cursors)
Controlled by the smartPaste.moreCursorsBehavior setting:
- 🎯
pasteSourceItems (Default) — The WebStorm way: pastes each copied item exactly once — one per cursor, in document order — and leaves the extra cursors untouched. The result is 3 items, never 12! ✅
- 🔁
vscodeDefault — The standard VS Code way: pastes the entire copied text block at each destination cursor.
- 🤔
ask — Shows a lightweight quick-pick menu letting you choose on the fly.
🖱️ Strictly Multi-Cursor
The smart behavior only applies when the copy was made with more than one cursor. If you select multiple lines (say, 5) with a single cursor, pasting at 2 cursors predictably pastes all 5 lines at each of the 2 cursors — never just the first 2 lines. (This also conveniently stops VS Code from silently splitting lines when the line count randomly matches the cursor count.)
🌐 External Fallback
If you copy text from your browser, terminal, or another app, the extension leaves it alone and falls back to vanilla VS Code paste.
⚙️ Settings Overview
| Setting |
What it controls |
Options |
Default |
smartPaste.mismatchBehavior |
Pasting with fewer cursors than copied items |
pasteFirstN / vscodeDefault / ask |
pasteFirstN |
smartPaste.moreCursorsBehavior |
Pasting with more cursors than copied items |
pasteSourceItems / vscodeDefault / ask |
pasteSourceItems |
📌 Notes & Tips
- ✂️ Cut works too: Cutting with multiple cursors records segments exactly the same way as copying.
- 🎛️ Keybinding Conflicts: If you already have custom keybindings for
Ctrl+C/X/V, you may need to adjust their precedence in the VS Code Keyboard Shortcuts editor.
🛠️ Development
Want to contribute or build from source?
npm run build # 🏗️ Compile the extension
npm test # 🧪 Compile + run unit tests (node --test)