Skip to content

fix(shell): open Claude Code's /plan open in Notepad on Windows - #2

Merged
baairon merged 3 commits into
mainfrom
claude/quirky-lamport-3d7mgh
Oct 6, 2026
Merged

baairon merged 3 commits into
mainfrom
claude/quirky-lamport-3d7mgh

Conversation

@baairon

@baairon baairon commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Problem

On Windows, /plan open in Claude Code started from a workspace terminal launches $VISUAL, which is nvim. That nvim exits with code 1 before it draws anything. The pane goes blank and Claude Code reports Nvim quit unexpectedly (exit code 1). #1 fixed Esc handling in a nested nvim, but not this.

Change

shell/bashrc, Git Bash only ($OSTYPE is msys* or cygwin*):

  • VISUAL=notepad: Claude Code reads VISUAL before EDITOR. It treats notepad as a GUI editor and opens the plan in its own window.
  • GIT_EDITOR=nvim: without this, git would also use VISUAL and open commit messages in Notepad.

EDITOR stays nvim. macOS and Linux keep nvim for 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 main is only shell/bashrc.

Testing

  • bash -n shell/bashrc passes.
  • With OSTYPE=msys, sourcing the file gives EDITOR=nvim VISUAL=notepad GIT_EDITOR=nvim. Without it, VISUAL stays nvim.
  • Not yet tried on the Windows machine itself.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Pr6jVTWbDwEJ4p8ZANoqzs


Generated by Claude Code

claude added 3 commits October 6, 2026 20:55
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
@baairon
baairon merged commit ec60cad into main Oct 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants