Skip to content

feat(keybindings): Ctrl+Arrow word navigation#58

Open
roramirez wants to merge 1 commit into
mainfrom
feature/ctrl-arrow-word-nav
Open

feat(keybindings): Ctrl+Arrow word navigation#58
roramirez wants to merge 1 commit into
mainfrom
feature/ctrl-arrow-word-nav

Conversation

@roramirez

@roramirez roramirez commented Jul 4, 2026

Copy link
Copy Markdown
Owner

What it does

Ctrl+Arrow now sends the standard xterm word-navigation sequences to the PTY:

Key Sequence
Ctrl+← CSI 1;5D
Ctrl+→ CSI 1;5C
Ctrl+↑ CSI 1;5A
Ctrl+↓ CSI 1;5B

Readline-based shells (bash/zsh) and editors (vim, nano, micro) use these to jump word by word. mmterm did not emit them before.

Changes

  • src/input/keybindings.rs: 4 new arms in ctrl_char_action (the Ctrl-without-Shift branch). No collision with Ctrl+Shift+Arrow (pane resize) or Ctrl+PageUp/Down (tab switching).
  • src/input/keybindings_test.rs: tests for all 4 directions, one in Normal mode, plus a regression that Ctrl+Shift+→ still maps to ResizePaneRight.
  • CHANGELOG.md.

How to test manually

  1. In this worktree: cargo run.
  2. At the prompt (bash/zsh), type foo bar baz and leave the cursor at the end.
  3. Ctrl+← jumps to the start of baz; again to the start of bar; etc. Ctrl+→ jumps forward word by word.
  4. Raw verification: run cat -v, then press Ctrl+← / Ctrl+→ and confirm ^[[1;5D / ^[[1;5C appear.
  5. Regression:
    • Ctrl+Shift+←/→ still resizes the active pane (does not move by word).
    • Ctrl+PageUp/PageDown still switches tabs.

Tests

cargo test — full suite green (includes ctrl_arrow_left_sends_word_back, ctrl_arrow_right_sends_word_forward, ctrl_arrow_up/down, ctrl_arrow_word_nav_works_in_normal_mode, ctrl_shift_arrow_right_still_resizes).

Ctrl+Left/Right/Up/Down now emit the xterm CSI 1;5 D/C/A/B sequences so
shells (readline) and editors can jump by word. Ctrl+Shift+Arrow still
resizes the active pane and Ctrl+PageUp/Down still switches tabs.
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.

1 participant