claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Vim-mode Insert inserts escape sequences for Option+Arrow keys

Open zubin opened this issue 2 months ago • 1 comments

Bug Description

When using vim-mode (enabled via /vim), after opening editor with ctrl-g and returning to prompt, pressing Option+Arrow keys in Insert mode inserts visible noise characters into the prompt instead of handling them gracefully.

This happens within a tmux session (without tmux, when returning from editor, [I is appended).

Expected behaviour: Same as terminal vim - Option+Arrow in Insert mode should either:

  • Move cursor by word (common terminal behavior), or
  • Be ignored (no-op) [my personal preference]

Actual behaviour: Escape sequences appear as visible garbage characters in the input, eg:

> [O[I[O[I[O[I[O[I[O[I[O[I

Steps to reproduce:

  1. Enable vim-mode with /vim
  2. Press ctrl-g to open editor (mine is EDITOR="bob run nightly")
  3. Exit editor (:q)
  4. Start typing (Insert mode)
  5. Press Option+Left or Option+Right
  6. Observe noise characters inserted into promptEnvironment:
    • macOS with tmux
    • Standard terminal (Ghostty.app)

Impact: Users with Option+Arrow bound to tmux pane navigation cannot switch panes without exiting Insert mode first, unlike standard vim behaviour. Exiting Insert mode (ie pressing esc) risks interrupting the agent (by pressing esc twice).

Environment Info

  • Platform: darwin
  • Terminal: tmux
  • Version: 2.0.64
  • Feedback ID: 85e27fd3-e07b-4a3d-8bbb-da88c5be0e82

zubin avatar Dec 10 '25 22:12 zubin

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/10375
  2. https://github.com/anthropics/claude-code/issues/11391
  3. https://github.com/anthropics/claude-code/issues/12242

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

github-actions[bot] avatar Dec 10 '25 23:12 github-actions[bot]

This issue has been automatically closed as a duplicate of #10375.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 14 '25 09:12 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Dec 22 '25 14:12 github-actions[bot]