Photo by Rahul Mishra on Unsplash
So I was refactoring a config file at like 11pm — one of those JSON monsters with 40 nearly identical keys — and I'm sitting there manually editing each line like an absolute caveman. My colleague walks by, watches me for about 10 seconds, and just goes "dude, multi-cursor." I felt mildly humiliated. But also enlightened. That was three years ago and I genuinely use VS Code multi-cursor editing almost every single day now.
If you've never really gone deep on this feature, you're leaving serious time on the table. Let me walk you through how it actually works — not just the obvious stuff, but the bits that take a while to discover on your own.
The Basics: Placing Cursors Manually
The most straightforward way to place multiple cursors is holding Alt (Windows/Linux) or Option (Mac) and clicking wherever you want a cursor. Each click drops a new cursor and you can type, delete, or paste across all of them simultaneously. Sounds simple, but people underestimate how powerful this is for scattered edits that don't follow a pattern.
For adding cursors above or below your current line, use:
Ctrl + Alt + Up/Down Arrow (Windows/Linux)
Cmd + Option + Up/Down Arrow (Mac)
This is great when you've got a block of lines and you want to append or prepend something to all of them at once. Add a comma, wrap something in quotes, slap a semicolon at the end — whatever you need. Honestly this alone saves me probably 20 minutes a week.
Select All Occurrences — The One You Actually Need
Here's the thing though — the real power move is selecting all occurrences of a word. Highlight a variable name or string, then hit:
Ctrl + Shift + L (Windows/Linux)
Cmd + Shift + L (Mac)
Boom. Every single instance of that text in the file gets its own cursor. Now you can rename that variable, wrap it, delete it — all at once, no find-and-replace dialog needed. I use this constantly when renaming things during a quick refactor and I don't want to break out a full rename symbol operation.
Related to this — if you want to select occurrences one at a time (so you can skip certain ones), use:
Ctrl + D (Windows/Linux)
Cmd + D (Mac)
Each press grabs the next match. Hit it once to get the next occurrence, again to get the one after that. If you accidentally grab one you don't want, Ctrl + K then Ctrl + D skips that match and moves to the next. That skip combo took me an embarrassingly long time to find.
Column / Box Selection
Now here's where it gets tricky and honestly where a lot of people don't realize multi-cursor editing applies. Column selection lets you drag a rectangular block across multiple lines — super useful for columnar data, log files, or those moments where you need to edit the 5th character on 20 consecutive lines.
Shift + Alt + drag mouse (Windows/Linux)
Shift + Option + drag mouse (Mac)
Or keyboard only — hold Shift + Alt (or Shift + Option) and use arrow keys to extend the column selection. This creates a cursor at the same position on every line in the selection. I've used this to strip out prefixes from a column of values pasted from a spreadsheet more times than I can count.
Insider Trick #1: Multi-Cursor with Regex Find
Okay this one's a bit of a hidden gem. Open Find (Ctrl + F / Cmd + F), enable regex mode with Alt + R, type your pattern, and then hit Alt + Enter. This selects every match in the file as a cursor simultaneously. No extra steps.
So say you've got a bunch of lines like const foo = "bar" and you want to grab just the values inside the quotes — write a regex for that, hit Alt + Enter, and now you've got cursors inside every quoted string. From there you can type, wrap with something, whatever you need. Combine this with capture groups and your Find/Replace and you've basically got a tiny sed command right inside the editor.
Insider Trick #2: Cursor Undo
This one saves me when I go a bit trigger-happy with Ctrl + D and grab too many occurrences. Instead of pressing Escape and losing all your cursors, hit:
Ctrl + U (Windows/Linux)
Cmd + U (Mac)
This undoes the last cursor action — so you can step back one cursor at a time without blowing up your whole multi-selection. It's the undo button specifically for cursor placement, not for text changes. Took me forever to stumble on this and I've never seen it mentioned in any quick tips article.
A Few Settings Worth Tweaking
If you're doing heavy multi-cursor work, there's one setting worth knowing about. By default, VS Code uses Alt+Click to place cursors, but if you're on certain laptop trackpads or Linux setups, that can conflict with system shortcuts. You can change the multi-cursor modifier in settings:
Go to File → Preferences → Settings and search for editor.multiCursorModifier. Switch it from alt to ctrlCmd if you're having conflicts. Small thing but it's annoying as hell when your cursor shortcuts keep getting intercepted by your OS.
Also — if you want to see your cursors more clearly (especially on dark themes where the thin blinking line disappears), bump up editor.cursorWidth to something like 3 or 4 in your settings JSON. Way easier to track multiple cursors when they're actually visible.
When Multi-Cursor Isn't the Right Tool
Worth saying — multi-cursor editing is amazing for structural edits and quick renames within a file, but if you're doing a rename across an entire codebase, use the actual rename symbol feature (F2) or a proper find-and-replace across files (Ctrl + Shift + H). I've seen people try to multi-cursor their way through a 50-file refactor and it's... not pretty. Right tool for the right job.
But for single-file work, repetitive edits, column transformations, and quick renames? Multi-cursor is faster than anything else. Get these shortcuts into muscle memory and you'll wonder how you coded without them. Hope this saves you from your own 11pm caveman moment.
Related: VS Code Tips and Tricks That Actually Save You Time (No Fluff)
๋๊ธ
๋๊ธ ์ฐ๊ธฐ