Why Multi-Cursor Editing Matters
A huge chunk of everyday coding isn't writing new logic — it's mechanical, repetitive edits: renaming a handful of variables, adding a prefix to every line in a list, reformatting a JSON block, or tweaking the same pattern across a dozen similar lines. Doing that one line at a time with find-and-replace or manual retyping is slow and error-prone. VS Code's multi-cursor editing lets you place several cursors at once and type, delete, or transform all of them simultaneously, turning a multi-minute chore into a two-second operation.
Placing Cursors Manually
- Alt+Click (Windows/Linux) or Option+Click (macOS) anywhere in the editor to drop an additional cursor at that exact spot.
- Ctrl+Alt+Down / Ctrl+Alt+Up (Windows/Linux) or Cmd+Option+Down / Cmd+Option+Up (macOS) adds a cursor directly above or below your current one, at the same column — perfect for editing a vertical list or column of values.
- Every cursor behaves independently once placed: typing, arrow-key navigation, and deletion all happen at each cursor position at the same time.
Press Escape at any point to collapse back down to a single cursor.
Selecting All Occurrences of a Word
This is the shortcut most people reach for the most often:
- Ctrl+D (Windows/Linux) or Cmd+D (macOS) selects the word under your cursor, then selects the next matching occurrence each additional time you press it. This lets you skip occurrences you don't want to change — select one, decide you don't want it, press Ctrl+D again to skip to the next, and continue.
- Ctrl+Shift+L (Windows/Linux) or Cmd+Shift+L (macOS) selects every occurrence of the currently selected word in the file at once, immediately, no repeated pressing needed.
const userName = getUserName();
console.log(userName);
saveUser(userName);
return userName;
Double-click userName once, then press Ctrl+Shift+L, and all four instances become editable simultaneously — type a new name and every occurrence updates together. This is a quick, file-scoped alternative to a formal "Rename Symbol" refactor (F2), useful when you want the raw text-level control rather than language-aware renaming.
Column (Box) Selection
For editing a rectangular block — like adding the same prefix to every line in a list, or deleting a column of leading characters — use box selection instead of matching cursors to word boundaries:
- Shift+Alt+Drag the mouse to draw a rectangular selection across multiple lines.
- Or hold Ctrl+Shift+Alt and press the arrow keys to extend a box selection from the keyboard without touching the mouse.
Once the box selection is active, anything you type is inserted at that same column on every selected line simultaneously — useful for adding // comment markers, quotation marks, or a common prefix across a list of variables or array values.
Adding Cursors to Line Ends
Select multiple lines, then press Shift+Alt+I to place a cursor at the end of every selected line at once. This is the fastest way to add a trailing character — a semicolon, a comma for converting lines into an array, a closing tag — to a whole block in one motion:
const a = 1
const b = 2
const c = 3
Select all three lines, press Shift+Alt+I, type ;, and every line gets its semicolon simultaneously.
Combining With Find
Open the Find widget (Ctrl+F), type a search term, and click the Select All Occurrences icon in the Find widget's toolbar (or press Alt+Enter while the Find box is focused) to turn every match in the file into an editable multi-cursor selection — useful when you want find's regex support for matching patterns rather than an exact literal word.
Practical Example: Editing a List of Imports
import Button from './Button'
import Card from './Card'
import Modal from './Modal'
import Input from './Input'
To add .jsx to the end of every path: select the four lines, press Shift+Alt+I to get a cursor at the end of each, press End to make sure each cursor is truly at line end, then type .jsx before the closing quote — or more simply, use Ctrl+Shift+L after selecting one closing quote character if the pattern is identical across all lines, and type your addition once.
Wrap-Up
Multi-cursor editing is one of those VS Code features that feels awkward for the first few uses and then becomes completely automatic. The three shortcuts worth committing to muscle memory first are Ctrl+D (select next occurrence), Ctrl+Shift+L (select all occurrences), and Shift+Alt+Drag (box selection) — between them they cover the vast majority of repetitive multi-line edits you'll run into day to day.
Discussion & Insights