[Feature Request] Allow configuring external editor for Ctrl-G prompt editing
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
EDITORenvironment 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
EDITORconfigured
Thank you for considering this enhancement.
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Closing as duplicate of #4922.
Our issue provides additional context that may be valuable for the discussion:
EDITOR/VISUALenvironment variablesSee the full description above for details that may help with implementation.
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.
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.
Thanks! Ctrl+G does honor
VISUALand thenEDITOR; 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 startclaudefrom, 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 viaopenreturns immediately. Docs: https://code.claude.com/docs/en/interactive-modeClosing as covered; reopen if it still ignores your setting.
🤖 Generated with Claude Code