Mastering Multi-Cursor Editing in Cursor
Multi-cursor editing is one of the most powerful features in modern code editors, and Cursor takes it further by combining traditional multi-cursor techniques with AI assistance. This guide covers everything from basic selection to advanced regex-based editing that will transform how you manipulate code.

Why Multi-Cursor Editing Matters
When you need to make the same change in multiple places, multi-cursor editing saves enormous time compared to find-and-replace or manual editing. Common scenarios include:
- Renaming variables across multiple lines
- Adding prefixes or suffixes to multiple items
- Converting data formats (JSON to TypeScript interfaces, etc.)
- Removing or adding brackets, quotes, or delimiters
- Aligning code or comments
Multi-cursor editing shines when changes are structurally similar but not identical. For truly identical replacements, find-and-replace might still be faster.
Basic Multi-Cursor Techniques
Alt+Click (Option+Click on macOS)
The most intuitive way to place multiple cursors is to hold Alt (or Option on macOS) and click where you want each cursor.
How to use it:
- Hold
Alt/Option - Click each location where you want a cursor
- Start typing -- all cursors will insert text simultaneously
// Before: Place cursors at the start of each line with Alt+Click
const user = { name: 'Alice' };
const admin = { name: 'Bob' };
const guest = { name: 'Charlie' };
// After typing 'export ' at each cursor
export const user = { name: 'Alice' };
export const admin = { name: 'Bob' };
export const guest = { name: 'Charlie' };
You can place up to 10,000 cursors. In practice, more than 100 becomes hard to manage visually.
Cmd+D / Ctrl+D -- Add Selection to Next Find Match
This is the fastest way to select multiple occurrences of the same word or selection.
Basic workflow:
- Select a word or text segment
- Press
Cmd+D(macOS) orCtrl+D(Windows/Linux) to select the next occurrence - Repeat to select more occurrences
- Edit all selections simultaneously
// Select 'status' and press Cmd+D three times
interface Task {
status: 'pending';
status: 'active';
status: 'completed';
}
// Change all to 'state'
interface Task {
state: 'pending';
state: 'active';
state: 'completed';
}
Skipping an occurrence:
If you accidentally select an occurrence you don't want to change, press Cmd+K Cmd+D (macOS) or Ctrl+K Ctrl+D (Windows/Linux) to skip the current selection and move to the next.
Selecting all occurrences at once:
Press Cmd+Shift+L (macOS) or Ctrl+Shift+L (Windows/Linux) to select all occurrences of the current word in the file.
Be careful with "Select All Occurrences" in large files. You might select matches in comments or strings that you didn't intend to change.
Column Selection (Box Selection)
Column selection lets you select a rectangular block of text, placing a cursor at the beginning of each selected line.
Mouse-Based Column Selection
- Windows/Linux: Hold
Shift+Altand drag - macOS: Hold
Shift+Optionand drag
# Column select the prefixes and replace them
old_prefix_item1 = 100
old_prefix_item2 = 200
old_prefix_item3 = 300
old_prefix_item4 = 400
# After column selecting 'old_prefix_' and typing 'new_'
new_item1 = 100
new_item2 = 200
new_item3 = 300
new_item4 = 400
Keyboard-Based Column Selection
Place multiple cursors using keyboard shortcuts:
| Shortcut | Action |
|---|---|
Cmd+Option+Down / Ctrl+Alt+Down | Add cursor to line below |
Cmd+Option+Up / Ctrl+Alt+Up | Add cursor to line above |
Cmd+Option+Shift+Down / Ctrl+Alt+Shift+Down | Extend column selection down |
Cmd+Option+Shift+Up / Ctrl+Alt+Shift+Up | Extend column selection up |
Column selection is perfect for working with tabular data, aligned assignments, or any code with vertical structure.
Advanced Multi-Cursor Techniques
Multi-Cursor with Find and Replace
The find widget supports multi-cursor operations through regex.
- Open find with
Cmd+F/Ctrl+F - Enable regex mode (.* icon)
- Enter a pattern with capture groups
- Use
$1,$2, etc. in replacement
// Convert console.log statements to a custom logger
// Find: console\.log\((.*)\);
// Replace: logger.debug($1);
console.log('User logged in');
console.log('Data fetched');
console.log('Error occurred');
// Result:
logger.debug('User logged in');
logger.debug('Data fetched');
logger.debug('Error occurred');
Regex Multi-Line Editing
For complex transformations, combine regex with multi-cursor:
// Transform interface properties to class properties with defaults
interface Config {
timeout: number;
retries: number;
enabled: boolean;
}
// Find: (\w+): (\w+);
// Replace: public $1: $2 = defaultValues.$1;
// Result:
public timeout: number = defaultValues.timeout;
public retries: number = defaultValues.retries;
public enabled: boolean = defaultValues.enabled;
Creating Cursors at Line Ends
Select multiple lines and press Shift+Option+I (macOS) or Shift+Alt+I (Windows/Linux) to place a cursor at the end of each selected line.
{
"name": "project"
"version": "1.0.0"
"description": "A sample project"
}
// After selecting lines and pressing Shift+Option+I, add commas
{
"name": "project",
"version": "1.0.0",
"description": "A sample project",
}
Multi-Cursor Shortcuts Reference
| Action | macOS | Windows/Linux |
|---|---|---|
| Add cursor at click position | Option+Click | Alt+Click |
| Select next occurrence | Cmd+D | Ctrl+D |
| Select all occurrences | Cmd+Shift+L | Ctrl+Shift+L |
| Skip current and select next | Cmd+K Cmd+D | Ctrl+K Ctrl+D |
| Add cursor below | Cmd+Option+Down | Ctrl+Alt+Down |
| Add cursor above | Cmd+Option+Up | Ctrl+Alt+Up |
| Column select (mouse) | Shift+Option+Drag | Shift+Alt+Drag |
| Cursors at line ends | Shift+Option+I | Shift+Alt+I |
| Undo last cursor addition | Cmd+U | Ctrl+U |
| Focus next cursor | Cmd+F6 | Ctrl+F6 |
Practical Workflows
Workflow 1: Bulk Property Renaming
You have an object and need to rename multiple properties:
// Step 1: Place cursors at each property name with Cmd+D
const user = {
firstName: 'John',
firstName: 'Admin', // Oops, duplicate
firstName: 'Guest',
};
// Step 2: After renaming
const user = {
firstName: 'John',
lastName: 'Doe',
role: 'Admin',
};
Workflow 2: Generating TypeScript from JSON
Convert a JSON snippet to TypeScript interface properties:
{
"id": 1,
"title": "Hello",
"completed": false
}
- Paste JSON into a TypeScript file
- Use multi-cursor to transform each line:
- Column select the keys
- Add
readonlyprefix - Move cursors to after values
- Replace with TypeScript types
readonly id: number;
readonly title: string;
readonly completed: boolean;
Workflow 3: Adding Error Handling
Wrap multiple API calls with try-catch:
// Before
const user = await fetchUser(id);
const posts = await fetchPosts(user.id);
const comments = await fetchComments(posts[0].id);
// After multi-cursor editing
const user = await fetchUser(id).catch(handleError);
const posts = await fetchPosts(user.id).catch(handleError);
const comments = await fetchComments(posts[0].id).catch(handleError);
Combining Multi-Cursor with AI
Cursor's AI features work alongside multi-cursor editing:
- Select multiple functions with multi-cursor
- Press
Cmd+Kto open inline edit - Type a prompt like "add JSDoc comments"
- Cursor applies the transformation to all selected blocks
// Before
function add(a: number, b: number) { return a + b; }
function subtract(a: number, b: number) { return a - b; }
function multiply(a: number, b: number) { return a * b; }
// After AI multi-cursor edit
/**
* Adds two numbers
* @param a - First number
* @param b - Second number
* @returns Sum of a and b
*/
function add(a: number, b: number) { return a + b; }
/**
* Subtracts two numbers
* @param a - First number
* @param b - Second number
* @returns Difference of a and b
*/
function subtract(a: number, b: number) { return a - b; }
/**
* Multiplies two numbers
* @param a - First number
* @param b - Second number
* @returns Product of a and b
*/
function multiply(a: number, b: number) { return a * b; }
Common Pitfalls
| Pitfall | Solution |
|---|---|
| Cursors in wrong places | Press Escape and start over; use undo cursor (Cmd+U) |
| Accidental edits in comments/strings | Be selective with "Select All Occurrences" |
| Too many cursors to track | Work in smaller chunks, 5-10 cursors at a time |
| Inconsistent indentation breaks column selection | Ensure consistent tabs/spaces before column selecting |
| Regex replacement affects unwanted areas | Preview changes before applying |
Summary
Multi-cursor editing in Cursor gives you surgical precision for bulk changes:
Alt+Clickfor precise cursor placementCmd+D/Ctrl+Dfor selecting repeated patterns- Column selection for vertical text manipulation
- Regex find-and-replace for complex transformations
- Combine with AI (
Cmd+K) for intelligent bulk edits
Spend time mastering these shortcuts. The investment pays off every time you need to change more than a few lines at once.
Last updated: July 2025. Cursor shortcuts may vary by version and configuration.