# Inline AI edits

Press <kbd>⌘L</kbd> on a selection, describe the change, and review a streaming inline diff: Accept with Enter, Reject with Esc, Retry with one click.

Select a paragraph or equation, press ⌘L (Ctrl+L), and describe the change. Review the proposed edit in place before accepting it.

## The flow

1. **Select** the text to change (or just leave the cursor on a line; the line becomes the target).
2. Press ⌘L, or right-click and choose **Ask AI…**
3. A prompt box opens under the target. Type what you want, or tap a preset: **Improve**, **Fix grammar**, **Make concise**, **Expand**, **Fix LaTeX**, **Translate**.
4. The proposal streams in as an **inline diff** laid over your text: deletions struck through in red, additions in green. Your document is not modified yet.
5. Enter accepts, Esc rejects, or hit **Retry** for another take.

Your document changes when you accept the proposal. The surrounding text stays visible while you review.

## What powers it

Inline edit uses the same active provider and model as the [chat](/docs/ai-chat/) (the panel shows which), plus your [custom instructions](/docs/ai-setup/#set-writing-preferences). It produces a replacement for the selected passage. Move to chat when the work needs project tools or a compile.

The response is constrained to be a pure replacement for the selected text: no code fences, no commentary, no "Here's your improved version!".

## Details worth knowing

- The prompt box has its own **model picker**, so a quick fix can use a fast cheap model while the chat keeps a stronger one.
- Outgrown the inline box? **Hand off to chat**: your instruction and context move to the full agent's composer, tools and all. See [Chat & tools](/docs/ai-chat/).
- **⌘L again** closes an open session; so does Esc.
- Empty or whitespace-only targets are ignored; select something real.
- Errors show inline with **Retry** and **Dismiss**; if no provider is connected you get an **Open Settings → AI** shortcut instead.
- Accepted edits are ordinary editor changes: ⌘Z undoes them like anything else.

## When to use which AI surface

- **A sentence, a paragraph, an equation**: inline edit, right here.
- **Anything multi-file, structural, or needing a compile to verify**: [chat](/docs/ai-chat/), where the agent has tools.
- **A figure**: [Draw with AI](/docs/ai-figures/) or the [diagram composer](/docs/figures-diagrams/).
