Multi-Cursor Editing Shortcuts in VS Code and IntelliJ
Edit multiple lines simultaneously with multi-cursor shortcuts in VS Code and IntelliJ IDEA. Learn column selection, find-and-add, and regex-based multi-cursor techniques.
Cross-Application
Detailed Explanation
Multi-Cursor Editing
Multi-cursor editing lets you type the same text at multiple positions simultaneously. This is one of the most powerful editing features in modern code editors.
VS Code Multi-Cursor
- Add Cursor Above/Below (
⌘+⌥+↑/↓/Ctrl+Alt+↑/↓) — add a cursor on the line above or below - Add Cursor at Click (
⌥+Click/Alt+Click) — place an additional cursor anywhere you click - Select Next Occurrence (
⌘+D/Ctrl+D) — select the next occurrence of the current selection and add a cursor. Press repeatedly to add more. - Select All Occurrences (
⌘+Shift+L/Ctrl+Shift+L) — add cursors at every occurrence of the current selection - Column Selection (
⌘+Shift+⌥+Arrow/Ctrl+Shift+Alt+Arrow) — box/column selection mode - Undo Last Cursor (
⌘+U/Ctrl+U) — remove the last added cursor
IntelliJ Multi-Cursor
- Add Cursor (
⌥+Shift+Click/Alt+Shift+Click) — add a cursor at the click position - Clone Caret Above/Below (
⌥+⌥+↑/↓hold second ⌥ /Ctrl+Ctrl+↑/↓hold second Ctrl) — add a caret above or below - Select Next Occurrence (
⌃+G/Alt+J) — select next occurrence and add cursor - Select All Occurrences (
⌃+⌘+G/Ctrl+Alt+Shift+J) — select all occurrences - Column Selection (
⌥+Shift+Click+Drag/Alt+Shift+Click+Drag) — rectangular selection
Common Use Cases
- Rename a local variable — select the variable name, press
⌘+D/Ctrl+Dto add each occurrence, then type the new name - Add quotes to multiple lines — use column selection to place cursors at the start of multiple lines, then type the opening quote
- Convert a list format — select all lines with multi-cursor and edit each line simultaneously
- Change property names — use Select Next Occurrence to incrementally add cursors at matching text
Tips
- Press
Escto return to a single cursor - Multi-cursor respects word boundaries, so
⌘+Dwon't match partial words - Combine with Find and Replace for regex-powered multi-cursor edits
Use Case
Multi-cursor editing is used daily by developers for batch renaming, formatting lists, converting data formats, and making repetitive edits across multiple lines. It is faster than find-and-replace for small, visual edits where you can see each change as you type. Particularly useful when refactoring JSON, CSV data, or HTML attributes.