[Feature Request] Allow configuring external editor for Ctrl-G prompt editing

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 5 comments · opened Jan 18, 2026 · closed Aug 17, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Problem

When pressing Ctrl-G to edit a prompt in an external editor, Claude Code auto-detects installed IDEs rather than respecting the standard EDITOR or VISUAL environment variables. On systems with multiple IDEs installed, this leads to undesirable behavior.

My specific case: I have Cursor IDE installed alongside other tools. When I press Ctrl-G to make a quick edit to my prompt, Claude Code launches the full Cursor IDE. This is extremely heavyweight for simply editing a few lines of text—an entire IDE with all its extensions and services starts up just to edit a prompt.

I have configured EDITOR in my shell profile to use a lightweight text editor (macOS TextEdit), but Claude Code ignores this setting.

Current Behavior

  • Ctrl-G auto-detects IDEs in the environment (VS Code, Cursor, etc.)
  • The EDITOR environment variable is only respected for bash subprocesses (e.g., git commit), not for Ctrl-G
  • Users cannot override which editor Ctrl-G opens
  • Related: Issue #12546 reports Claude Code suggesting VS Code even when it's not installed

Requested Behavior

Ctrl-G should respect the EDITOR (or VISUAL) environment variable, or provide a dedicated setting to configure the external editor for prompt editing.

Proposed Solution

Option A: Respect EDITOR/VISUAL environment variables for Ctrl-G (consistent with Unix conventions)

Option B: Add a dedicated setting in ~/.claude/settings.json:

{
  "promptEditor": "/usr/bin/open -e -W -n"
}

Option C: Both—use the setting if present, fall back to EDITOR/VISUAL, then fall back to IDE auto-detection

Use Case

  • Users with multiple IDEs installed who want a lightweight editor for quick prompt edits
  • Users who prefer terminal-based editors (vim, nano, emacs)
  • Users who want consistent behavior with other Unix tools that respect EDITOR
  • Users on resource-constrained systems where launching a full IDE is slow

Related Issues

  • #10891 - Similar request for file editing operations (Edit/Write tools), closed without implementation. This request is distinct: it specifically addresses Ctrl-G prompt editing, not file operations.
  • #12546 - Bug where Claude Code suggests VS Code when it's not installed, indicating issues with IDE detection logic

Environment

  • Claude Code Version: Latest
  • Platform: macOS
  • Shell: zsh with EDITOR configured

Thank you for considering this enhancement.

View original on GitHub ↗

5 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/16342
  2. https://github.com/anthropics/claude-code/issues/282
  3. https://github.com/anthropics/claude-code/issues/4922

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

j-h-scheufen · 7 months ago

Closing as duplicate of #4922.

Our issue provides additional context that may be valuable for the discussion:

  • Specific problem: IDE auto-detection (Cursor) ignores EDITOR/VISUAL environment variables
  • Three proposed solutions: respect env vars, add settings.json config, or both with fallback chain
  • Use cases: lightweight editors, terminal editors (vim/nano), resource-constrained systems

See the full description above for details that may help with implementation.

j-h-scheufen · 7 months ago

Reopening: The issue I referenced (#4922) is closed and locked. Added our detailed context as a comment on #16342 (the only open duplicate). Keeping this open as it has the most comprehensive description of the problem and proposed solutions.

gradigit · 6 months ago

this was a huge pain point for me but i think i managed to build a good solution:
https://github.com/gradigit/claude-pager
by using a shim like claude-pager, you can set ctrl-g to whatever editor you want, and i have it setup so you set it within your claude settings.json intuitively.

i know it's still a shim and a workaround, but claude-pager also resolves the issue of claude code window going blank when you ctrl-g.
With this shim you get retain all your session context even in ctrl-g mode (and it renders instantly)

as a bonus, because i use ctrl-g a lot, i made a purpose-built prompt editor specifically for ctrl-g, focused purely on performance:
https://github.com/gradigit/turbodraft

now im able to ctrl-g and start typing immediately in ~50ms, with full session context.

bcherny collaborator · 13 days ago

Thanks! Ctrl+G does honor VISUAL and then EDITOR; it only falls back to detecting VS Code / vi / nano when neither is set in the environment Claude Code was launched from. A couple of things to check: make sure the variable is exported (export EDITOR=nano) in the shell you start claude from, and if you point it at a GUI app, use a command that blocks until the file is closed (e.g. code --wait), since TextEdit via open returns immediately. Docs: https://code.claude.com/docs/en/interactive-mode

Closing as covered; reopen if it still ignores your setting.

🤖 Generated with Claude Code