[BUG] Ctrl+G external editor kills the Windows Terminal window when $EDITOR is a terminal app (nvim)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Pressing Ctrl+G to hand off to an external editor (also reachable via /plan and /memory) produces no output and kills the entire Windows Terminal window when $env:EDITOR is set to a terminal-based editor such as nvim. The window closes immediately, Claude Code and the shell die with it, and no editor UI is ever drawn.
Scoping done so far:
- nvim runs fine standalone in the same PowerShell session in the same Windows Terminal window, so this is not a PATH or nvim-config problem.
- A GUI editor (
notepad) works correctly through the same Ctrl+G flow, so launching an editor at all is not the problem. - Only the full-screen console-app case fails, which points at the console/ConPTY handoff to a child that wants the alternate screen buffer, rather than at configuration.
What Should Happen?
nvim should open in the same terminal window with the prompt/plan content loaded, and on exit control should return cleanly to Claude Code with the edited content picked up, matching the behavior on macOS and Linux.
Error Messages/Logs
(none - the terminal window closes with no output, no stack trace, and no
Claude Code error message)
Steps to Reproduce
- On Windows 11 (build 26100), open Windows Terminal with a PowerShell profile.
- Install nvim and confirm it works: run
nvim, verify it draws, then:q. - Set the editor:
$env:EDITOR = "nvim", and confirm withecho $env:EDITOR. (Also reproduced withEDITORset as a persistent Windows user env var and via~/.claude/settings.json.) - Run
claude(2.1.222) in that window. - Type any prompt text, then press Ctrl+G. (
/plantriggers the same path.) - The entire Windows Terminal window closes immediately. No editor appears and no error is printed.
- Counter-check in a fresh window: set
$env:EDITOR = "notepad", then repeat steps 4-5. notepad opens, edits round-trip, and Claude Code continues normally.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.222
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
- OS: Windows 11 Pro, 10.0.26100
- Shell: PowerShell
$env:EDITOR:nvim
Possibly related, but distinct - in all of these the terminal survives, whereas here the window is destroyed outright:
- #73301 (open) - nvim opens via Ctrl+G in WezTerm on Windows but receives no keyboard input.
- #51363 (closed, not planned) - arrow-key escape sequences not forwarded to the child PTY on Windows, Helix unusable.
- #58664 (closed, not planned) - Ctrl+G spawn regression on Windows + Cygwin/MSYS2, TUI hangs instead of launching vim.
- #53595 (closed, completed) - Backspace/Ctrl+Backspace inverted after returning from nvim via Ctrl+G in Windows Terminal.