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.

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.

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