Send Reference to Terminal
Drop a precise code reference into your terminal with one keystroke. Perfect for AI coding assistants like Claude Code, Cursor, and Copilot CLI that understand @file#Lstart-end references.
Select some code, hit Alt+Cmd+K, and @src/extension.ts#L10-20 lands in your terminal — ready to paste into a prompt, a commit message, or a code-review note. No copying paths by hand. No counting line numbers.
Why you'll like it
- One smart key, two behaviors. Selection? You get the path and the line range. Nothing selected? You get just the file path. Same shortcut, no thinking required.
- Built for AI pair-programming. The
@path#L10-20 format is exactly what modern AI coding tools expect. Point your assistant at the right code instantly.
- Never executes. Text is typed into the terminal, not run — append it to a command, or send it as-is. You stay in control.
- Clickable both ways. References printed in the terminal become clickable links — click one to jump straight back to the file at that line.
- Zero config, zero clutter. No settings to tweak, no panels, no noise. It does one thing well.
- One-keystroke shortcut.
Alt+Cmd+K (macOS) / Ctrl+Alt+K (Windows/Linux). Using the Claude Code extension? It claims the same binding — see Using the Claude Code extension? below to resolve it.
How it works
| You do this |
You get this |
| Select lines 10–20, press the shortcut |
@src/extension.ts#L10-20 |
| Select a single line |
@src/extension.ts#L42 |
| Select nothing |
@src/extension.ts |
The reference is relative to your workspace folder and sent to the active terminal (a new one opens if none is running).
Get started
- Install the extension.
- Open any file in your workspace.
- (Optional) Select the lines you want to reference.
- Press
Alt+Cmd+K (macOS) or Ctrl+Alt+K (Windows/Linux) — or run Send Reference to Terminal from the Command Palette.
Want a different shortcut? Rebind Send Reference to Terminal in VS Code's Keyboard Shortcuts.
Using the Claude Code extension?
The Claude Code extension binds Alt+Cmd+K to its own command (claude-code.insertAtMentioned), and it takes precedence — so the shortcut may do nothing for this extension until you resolve the overlap. Two options:
Option A — free up Alt+Cmd+K for this extension. Open the Command Palette → Preferences: Open Keyboard Shortcuts (JSON) and add:
{
"key": "alt+cmd+k",
"command": "-claude-code.insertAtMentioned",
"when": "editorTextFocus"
}
The leading - removes Claude Code's binding, leaving Alt+Cmd+K for Send Reference to Terminal.
Option B — pick a different shortcut for Send Reference to Terminal in the Keyboard Shortcuts editor and leave Claude Code's binding untouched.
Requirements
- VS Code 1.105.0 or newer
- An open workspace folder
Credits
Based on Send Selection to Terminal by Bryce Remick — thanks for the original work.
License
MIT