PrototypeLesson 6 of 12

Make Inline Edits (Cmd+K)

2 min readCursor for Designers

Cmd+K is your quick-edit tool in the editor. Highlight code and press Cmd+K to change it by describing what you want. No agent conversation needed. In the Agents Window, Cmd+K searches instead.

The Cmd+K Workflow

1

Highlight code in your editor

Select the code you want to change.

2

Press Cmd+K (Mac) or Ctrl+K (Windows)

A prompt bar appears right above your code.

3

Type your instruction

Tell the AI what to do: "Make it faster", "Add error handling", "Use Tailwind instead"

4

Press Enter

Cursor edits the code inline and shows you the result.

Cmd+K inline editing: Smart rewrite transforming selected code

Example Edits

Here's what Cmd+K can do. Select the code and try:

Original code
if (user) { alert("Welcome"); }

Cmd+K → "Convert to console.log instead of alert"

After Cmd+K
if (user) { console.log("Welcome"); }

Cmd+K or the agent: when to use which

Both use AI, but for different situations:

  • Cmd+K: Quick changes to existing code (refactor, fix, adjust)
  • The agent (lesson 5): New features, changes across several files, explanations (Ask mode) and debugging
  • Cmd+L with code selected sends it to the agent if a quick edit turns out to be bigger

Bonus: Cmd+K in Terminal

You can also use Cmd+K in the Terminal (bottom of Cursor) to generate shell commands from natural language:

1

Click in the Terminal

Focus the terminal at the bottom of the screen.

2

Press Cmd+K (Mac) or Ctrl+K (Windows)

A prompt appears in the terminal.

3

Describe what you want

"Remove all node_modules folders" or "Restart the dev server"

4

Press Enter

Cursor generates and runs the command.

Review Terminal Commands

Always review terminal commands before pressing Enter. The AI might misunderstand, and bad terminal commands can cause problems.

Inline Editing Mastered!

  • You can select code and use Cmd+K to edit it
  • You know when to use Cmd+K and when to use the agent
  • You know how to use Cmd+K in the terminal
  • You're confident with quick, targeted edits

Cmd+K is your quick tool for small edits in the editor. Next, Design Mode: changing a running prototype by pointing at it.