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.
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.
Press Alt+Enter in the inline editor to ask questions about selected code.After getting an answer, type “do it” or similar wording to convert the suggestion into code. This lets you explore ideas before implementing.
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.
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.