[Bug] Vim-mode Insert inserts escape sequences for Option+Arrow keys
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:
- Enable vim-mode with /vim
- Press
ctrl-gto open editor (mine isEDITOR="bob run nightly") - Exit editor (
:q) - Start typing (Insert mode)
- Press Option+Left or Option+Right
- 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
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗