Inline Edit
Edit and ask questions with Inline Edit (Cmd/Ctrl+K) in Cursor
Inline Edit lets you edit code or ask questions directly in your editor with Ctrl+K, which opens an input field where your selected code and instructions create your request.
Modes
Edit Selection
With code selected, Ctrl+K edits that specific code based on your instructions.
Without selection, Cursor generates new code at your cursor position. The AI includes relevant surrounding code for context - for example, triggering on a function name includes the entire function.
Quick Question
Press Alt+Enter in the inline editor to ask questions about selected code.
After getting an answer, type “do it” to convert the suggestion into code. This lets you explore ideas before implementing.
Full File Edits
For file-wide changes, use Ctrl+Shift+Enter. This mode enables comprehensive changes while maintaining control.
Send to Chat
For multi-file edits or advanced features, use Ctrl+L to send selected code to Chat. This provides multi-file editing, detailed explanations, and advanced AI capabilities.
Follow-up instructions
After each edit, refine results by adding instructions and pressing Enter. The AI updates changes based on your feedback.
Default context
Inline Edit includes default context to improve code generation beyond any @ symbols you add.
This includes related files, recently viewed code, and relevant information. Cursor prioritizes the most relevant context for better results.