Repository navigation
fix(shell): open Claude Code's /plan open in Notepad on Windows - #2
Merged
Merged
Conversation
A program running $EDITOR in a workspace terminal (git commit, Claude Code's /plan open) starts a second nvim in that pane. The terminal's <Esc><Esc> mapping belongs to the outer nvim, so a double Esc typed in the nested one left terminal mode out there, and the :q or :wq after it closed the terminal pane instead. The nested nvim kept running hidden until it was killed, and Claude Code reported "Nvim quit unexpectedly (exit code 1)". The nested nvim now reports to the outer one over $NVIM, which gives that terminal a buffer-local nowait <Esc> that goes straight through until the nested nvim leaves, or dies and the next Esc finds its channel gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pr6jVTWbDwEJ4p8ZANoqzs
/plan open launches $VISUAL, and nvim started that way from a terminal inside the workspace nvim exits with code 1 before drawing, leaving the pane blank. On Git Bash, VISUAL is now notepad, which Claude Code hands the file to as a GUI editor. GIT_EDITOR=nvim keeps git's commit messages in the terminal, since git otherwise reads VISUAL before EDITOR too. Other platforms keep nvim for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pr6jVTWbDwEJ4p8ZANoqzs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
/plan openin Claude Code started from a workspace terminal launches$VISUAL, which isnvim. That nvim exits with code 1 before it draws anything. The pane goes blank and Claude Code reportsNvim quit unexpectedly (exit code 1). #1 fixed Esc handling in a nested nvim, but not this.Change
shell/bashrc, Git Bash only ($OSTYPEismsys*orcygwin*):VISUAL=notepad: Claude Code readsVISUALbeforeEDITOR. It treatsnotepadas a GUI editor and opens the plan in its own window.GIT_EDITOR=nvim: without this, git would also useVISUALand open commit messages in Notepad.EDITORstaysnvim. macOS and Linux keepnvimfor both variables.The branch also carries a merge of its earlier, already-merged tip, so it could be pushed without a force push. The diff against
mainis onlyshell/bashrc.Testing
bash -n shell/bashrcpasses.OSTYPE=msys, sourcing the file givesEDITOR=nvim VISUAL=notepad GIT_EDITOR=nvim. Without it,VISUALstaysnvim.🤖 Generated with Claude Code
https://claude.ai/code/session_01Pr6jVTWbDwEJ4p8ZANoqzs
Generated by Claude Code