Learn to reference code using @Code symbol and keyboard shortcuts for adding code to Chat or Edit

To reference specific sections of code, you can use the @Code symbol.

Code Preview

Similar to the @Files symbol, Cursor will show a preview of the code’s content so you can verify that the code you’re referencing is the correct one.

Image 1

From the Editor

Another way to add code snippets as context is to select the code you want to reference, and click on either “Add to Chat” (Ctrl/⌘ Shift L) or “Add to Edit” (Ctrl/⌘ Shift K).

These will add the selected code snippet to either the Chat input box or the currently active Cmd K prompt bar.

Image 2

To add a selected code to a new chat, you can press Ctrl/⌘ L.

Was this page helpful?