Skip to content

fix(tui): complete vim word-end and line-end behavior#24380

Merged
fcoury-oai merged 3 commits into
mainfrom
fcoury/fix-vim-mode
May 27, 2026
Merged

fix(tui): complete vim word-end and line-end behavior#24380
fcoury-oai merged 3 commits into
mainfrom
fcoury/fix-vim-mode

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

Why

The TUI Vim composer currently diverges from normal Vim editing in two common workflows: pressing e repeatedly can remain stuck at an existing word end, and normal mode does not support C for changing through the end of the line. The existing D behavior also removes the newline when the cursor is already at the line boundary, which makes the new C action and existing deletion action surprising in multiline prompts.

Closes #23926.
Closes #24238.

What Changed

  • Make normal-mode e advance from the current word end to the next word end, including for operator motions such as de.
  • Add configurable Vim normal-mode change_to_line_end behavior, bound to C by default, which deletes to the end of the current line and enters Insert mode.
  • Keep the newline intact when D or C is pressed at the end-of-line boundary.
  • Add regression coverage for repeated e, de, C, and the multiline C/D boundary behavior.
  • Regenerate the config schema and update the keymap picker snapshots for the new Vim action.

How to Test

  1. Run Codex with Vim composer mode enabled:
    cd codex-rs
    cargo run --bin codex -- -c tui.vim_mode_default=true
  2. Enter alpha beta gamma, press Esc, 0, then press e repeatedly.
    Confirm the cursor advances through the ends of alpha, beta, and gamma.
  3. Enter hello world, press Esc, 0, w, then C.
    Confirm world is deleted and the composer enters Insert mode.
  4. Enter a multiline prompt with hello above world, press Esc, k, $, and then D.
    Confirm the newline is preserved and the two lines do not join.
  5. At the same boundary, press C and type !.
    Confirm the composer enters Insert mode and yields hello! above world, preserving the newline.

Targeted automated verification:

  • just fix -p codex-tui
  • just argument-comment-lint-from-source -p codex-tui -p codex-config
  • cargo insta pending-snapshots reports no pending snapshots.
  • just test -p codex-tui validates the new Vim and keymap snapshot coverage, but the command remains red due to two reproducible unrelated failures in app::tests::update_feature_flags_disabling_guardian_*.

Validation Note

The workspace-wide just argument-comment-lint form is currently blocked during Bazel analysis by the existing LLVM compiler-rt missing include/sanitizer/*.h failure; package-scoped source linting for the changed Rust crates passed.

@fcoury-oai fcoury-oai requested a review from a team as a code owner May 24, 2026 23:15
@fcoury-oai fcoury-oai enabled auto-merge (squash) May 26, 2026 18:33
Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config change looks fine

@fcoury-oai fcoury-oai merged commit aa18454 into main May 27, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/fix-vim-mode branch May 27, 2026 14:36
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tui): add Vim normal-mode C binding to change to end of line TUI Vim composer mode: repeated e does not advance to the next word end

3 participants