VS Code Multi-Cursor Editing Tricks That Will Actually Change How You Code

VS Code Multi-Cursor Editing Tricks That Will Actually Change How You Code

Photo by Rahul Mishra on Unsplash

So I was refactoring a config file at some ungodly hour — something like 60 lines of nearly identical JSON keys — and my coworker walked by and watched me manually editing each one. He just stared at me for a second, said nothing, and reached over to hit three keystrokes. Suddenly there were cursors on every single line simultaneously. I felt like an idiot. That was the day I actually sat down and learned VS Code multi-cursor editing properly, and I haven't looked back since.

If you're still editing repetitive code line by line, this post is going to feel like cheating. Good.

The Basic Multi-Cursor Shortcut Everyone Knows (But Uses Wrong)

Most people know you can hold Alt (or Option on Mac) and click to drop multiple cursors wherever you want. That's fine. But I see people using this to click on 30 individual lines, which defeats the entire purpose. That's like using a nail gun to tap in one nail at a time.

The move you actually want for stacked, consecutive lines is Ctrl+Alt+Down (or Cmd+Option+Down on Mac) to add a cursor one line below, repeatedly. Hold it down and watch the cursors stack. Then just type and every line gets the same edit simultaneously. Want to go upward? Ctrl+Alt+Up. Simple, fast, and honestly satisfying in a weird way.

The One That Actually Saves the Most Time: Select All Occurrences

Here's the thing though — the real power move is selecting every instance of a variable, class name, or string across your entire file at once.

Highlight any word, then hit Ctrl+Shift+L (Windows/Linux) or Cmd+Shift+L (Mac). VS Code will drop a cursor on every single occurrence of that selection in the file. Now you can rename, wrap, delete, or transform all of them at the same time. No regex. No find-and-replace dialog. Just... done.

There's also Ctrl+D (Cmd+D on Mac) which selects the next occurrence one at a time — useful when you want to be selective. Hit it a few times to grab just the ones you want, skip one with Ctrl+K, Ctrl+D, then edit. I use this probably a dozen times a day.

Column (Box) Selection — The Underrated One

This one genuinely surprises people. If your code has a block of text aligned vertically — like a list of variable assignments — you can select a column across multiple lines and edit all of them at once.

Hold Shift+Alt and then drag your mouse down (or use Shift+Alt+Down arrow key). You'll get a rectangular selection, not a line-by-line one. This is perfect for things like adding a prefix to a bunch of property names, or ripping out a column of data you don't need.

Honestly, this is the feature I show new devs first because it looks like magic and it gets them interested in learning the rest.

Insider Trick #1: Multi-Cursor With Find and Replace

Most people treat Find & Replace (Ctrl+H / Cmd+H) as a separate tool from multi-cursor editing. But here's something a lot of folks miss — when you're in the Find widget (Ctrl+F), you can click the little "Select All Occurrences" button (or press Alt+Enter) and it dumps you back into the editor with every match already selected as a multi-cursor.

This means you can use regex to find a complex pattern, hit Alt+Enter, and then surgically edit every match live in context. Way more intuitive than trying to write a regex replacement string — especially when you just want to see what you're changing before you commit to it.

Insider Trick #2: Middle Mouse Button for Cursors

If you're on a machine with a middle mouse button, you can hold Alt and middle-click drag to do a column selection without using the keyboard at all. It's a small thing, but on a large monitor with a lot of vertical code, it's surprisingly fast.

(Side note: VS Code's settings for multi-cursor behavior live under File > Preferences > Settings — search for editor.multiCursorModifier if you want to swap Alt for Ctrl as your multi-cursor key. Some people prefer it, especially if Alt conflicts with system shortcuts on Linux.)

Practical Example: Renaming Object Keys in Bulk

Say you've got something like this:

const config = {
  user_name: "",
  user_email: "",
  user_phone: "",
  user_address: "",
};

You need to strip the user_ prefix from every key. Just double-click user_name to select it, then use Ctrl+D three more times to grab all four occurrences of user_ (you'd select just that prefix part). Then delete. Four lines, one action. Done in two seconds.

Now here's where it gets tricky — sometimes the occurrences you're selecting with Ctrl+D are context-dependent and you'll accidentally grab one you didn't want. That's what Ctrl+K, Ctrl+D is for — it skips the current selection and jumps to the next one without adding a cursor there. Think of it as "skip this one."

Quick Reference Cheat Sheet

Since I know someone's going to want this in a copy-paste format:

Add cursor below:         Ctrl+Alt+Down     (Cmd+Option+Down on Mac)
Add cursor above:         Ctrl+Alt+Up       (Cmd+Option+Up on Mac)
Select next occurrence:   Ctrl+D            (Cmd+D on Mac)
Skip current occurrence:  Ctrl+K, Ctrl+D    (Cmd+K, Cmd+D on Mac)
Select all occurrences:   Ctrl+Shift+L      (Cmd+Shift+L on Mac)
Column selection drag:    Shift+Alt+drag
Select all find matches:  Alt+Enter (while Find widget is open)

In my experience, the biggest barrier to using multi-cursor editing consistently isn't knowing the shortcuts — it's building the reflex to reach for them instead of defaulting to manual edits. The next time you catch yourself about to edit three or more similar lines by hand, stop. That's your signal.

Hope this saves you a few hours of tedious editing. Your future self will thank you — probably at 2am during a refactor.

Related: VS Code Tips and Tricks That Actually Save You Time (Not Just the Obvious Ones)

๋Œ“๊ธ€

Zoho IMAP Settings: The Complete Fix When Your Email Stops Syncing

Quick Summary Zoho IMAP breaks more often than it should, and the error messages are genuinely useless. The fix is usually a combination of using the right server address, enabling IMAP inside Zoho Mail's settings, and generating an app-specific password. This guide covers the exact steps for Outlook, iPhone, Thunderbird, and Android so you stop going in circles. Photo by Fotis Fotopoulos on Unsplash So your Zoho Mail stopped syncing. Emails aren't coming in, your phone shows a spinning indicator forever, or Outlook throws some vague authentication error and you have no idea what changed. Sound familiar? I've seen this exact situation probably thirty times across different clients, and every single time the person swears they didn't change anything. And honestly? They usually didn't. Zoho changed something on their end, or an app update reset a setting, or someone enabled two-factor authentication without realizing what that does to third-party mail clients. The...

Zoho Mail IMAP Configuration: Exact Settings That Work First Time

Quick Summary Getting Zoho Mail IMAP to work in Outlook or Thunderbird is not as straightforward as Zoho's docs make it sound. The port numbers, SSL settings, and app password requirements catch almost everyone off guard the first time. Here are the exact settings and steps that actually work, without the back-and-forth with support. Photo by Fotis Fotopoulos on Unsplash Last month I spent almost two hours on a Friday afternoon helping a new employee get Zoho Mail working in Outlook. Two hours. The settings look simple on paper — and honestly, they are — but there are two or three specific things that Zoho just does not make obvious, and if you miss any one of them, you get a generic authentication error that tells you absolutely nothing useful. Sound familiar? The thing is, I've set up Zoho IMAP maybe forty times across different clients and different mail apps. Outlook, Thunderbird, Apple Mail, even some third-party Android clients. And every single time, someone new come...

์ด ๋ธ”๋กœ๊ทธ ๊ฒ€์ƒ‰

Magnesium Glycinate vs Magnesium Citrate: Which One Actually Fixed My Sleep

Quick Summary I spent months trying different magnesium forms after my sleep fell apart, and the difference between glycinate and citrate is way bigger than I expected Glycinate is the gentler, slower option great for sleep and anxiety, while citrate works faster but comes with some digestive surprises nobody warns you about If you're confused about which one to take, this breaks down exactly what each form does and who should actually be using it Photo by Anshu A on Unsplash About two years ago I hit a wall. I was waking up at 3am every single night, my legs felt restless, and I was grinding my teeth so bad my jaw hurt in the morning. My doctor ran some basic labs, everything came back "normal," and I left that appointment feeling completely dismissed. A friend of mine — she's really into functional nutrition — casually mentioned that I might just be magnesium deficient. I kind of rolled my eyes at first. It sounded like one of those wellness buzzwords people throw...
↑