Skip to main content

Inline Edit & Ctrl+K Magic — Chat & Context Management

[ ABORT TO HUD ]
SEQ. 1
SEQ. 2

Inline Edit & Ctrl+K Magic

💬 Chat & Context Management 15 min 250 BASE XP⌨ HANDS-ON LAB

In-Place AI Editing

The Inline Edit panel (Ctrl+K) is the fastest way to make targeted code changes. Select code, press Ctrl+K, describe what you want, and the AI modifies it in-place with a clear diff view.

Workflow

  1. Select code (or place cursor on a line)
  2. Press Ctrl+K to open the inline prompt
  3. Describe the change: "Add error handling", "Convert to async/await", "Add TypeScript types"
  4. Review the green/red diff showing exactly what changes
  5. Ctrl+Enter to accept, Ctrl+Backspace to reject

Without Selection

If you press Ctrl+K without selecting any code, Cursor generates new code at the cursor position. This is perfect for quickly scaffolding functions, adding imports, or inserting boilerplate.

Ask vs Inline Edit vs Agent

ToolScopeBest For
Ask mode (Ctrl+L)Read-only Q&A, explanationsUnderstanding code, debugging
Inline (Ctrl+K)Single-file edits - editor & terminalQuick targeted modifications
Agent (Ctrl+I)Multi-file edits & autonomous tasksFeatures, refactoring, agent workflows
⌨ HANDS-ON LABInspect Workspace Diffs via CLI
⭐ +125 XP

Inline Edit (Ctrl+K) modifies code in-place with visual red/green diffs. Use the Cursor CLI diff tool to compare files from the terminal.

1Launch a side-by-side diff between two files using cursor --diff.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 2
What happens when you press Ctrl+K without selecting any code?
Nothing
It opens the chat panel
Cursor generates new code at the cursor position
It deletes the current line