Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Editor to CLINew to Visual Studio Code? Get it now.
Editor to CLI

Editor to CLI

Sureshdeva

|
1 install
| (0) | Free
Attach selected code to AI CLI tools like Claude directly from VS Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Editor to CLI

Attach selected code to AI CLI tools like Claude directly from VS Code — via terminal injection or clipboard — without leaving your editor.

Repository: https://github.com/sureshdevaj/editor-to-cli


Features

  • Attach selected code to AI CLI — one shortcut captures your selection with file and line context
  • 3 path format modes — relative path, absolute path, or auto-detected GitHub permalink
  • Terminal-first transport — inject the prompt directly into a named terminal (e.g. a running claude session)
  • Clipboard fallback — automatically falls back to clipboard when no matching terminal is found
  • Configurable settings — control transport mode, path format, terminal name matching, and auto-enter behaviour
  • No telemetry — zero data collection, no network calls, no tracking of any kind

Usage

  1. Open any source file in VS Code
  2. Select the code you want to send to your AI CLI
  3. Press Cmd+Shift+. (Mac) or Ctrl+Shift+. (Windows / Linux)

The extension formats your selection as a file reference and delivers it to the configured destination.


Keyboard Shortcut

Platform Shortcut
macOS Cmd + Shift + .
Windows / Linux Ctrl + Shift + .

Only active when the editor is focused and text is selected.


Path Formats

Control how the file reference is formatted using editorToCli.pathFormat:

Value Example output
relative (default) src/transport.ts#L10-20
absolute /Users/you/project/src/transport.ts#L10-20
github https://github.com/user/repo/blob/main/src/transport.ts#L10-L20

GitHub permalink mode

When pathFormat is set to "github", the extension:

  1. Reads the origin remote URL from your project's .git/config
  2. Reads the current branch from .git/HEAD
  3. Builds a full GitHub permalink automatically

Supports both SSH (git@github.com:...) and HTTPS remote formats. Falls back to relative path with a warning if git info cannot be detected.


Transport Modes

Mode Behaviour
auto (default) Looks for a terminal whose name contains terminalMatch. Injects if found, otherwise copies to clipboard.
terminal Always injects into the currently active terminal.
clipboard Always copies to clipboard — useful when your AI CLI runs outside VS Code.

Configuration

Open Settings (Cmd+, / Ctrl+,) and search for Editor to CLI, or edit your settings.json directly:

{
  "editorToCli.pathFormat": "relative",
  "editorToCli.transport": "auto",
  "editorToCli.terminalMatch": "claude",
  "editorToCli.autoEnter": false
}
Setting Type Default Description
editorToCli.pathFormat "relative" | "absolute" | "github" "relative" Format of the file path in the output
editorToCli.transport "auto" | "terminal" | "clipboard" "auto" How to deliver the prompt
editorToCli.terminalMatch string "claude" Substring matched (case-insensitive) against terminal names in auto mode
editorToCli.autoEnter boolean false Press Enter automatically after injecting into the terminal

No Telemetry

This extension does not collect any usage data, does not make any network requests, and does not use any external dependencies. It uses only the VS Code API.


License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft