Skip to content

feat(vim): add paragraph and sentence motions - #303

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/vim-paragraph-sentence-motions
Aug 21, 2026
Merged

fcoury-oai merged 1 commit into
mainfrom
fcoury/vim-paragraph-sentence-motions

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

Red's Vim mode supports word motions and paragraph text objects, but it lacks Neovim's paragraph and sentence navigation and sentence text objects. That makes everyday prose and code navigation inconsistent between the file editor and embedded modal textareas.

What changed

  • Add { / } paragraph motions and ( / ) sentence motions to the file editor and embedded textareas, including counts, Visual selections, operator-pending forms, jumplist integration, and Unicode-safe cursor positioning.
  • Add counted is / as sentence text objects with Neovim-compatible sentence whitespace, punctuation and closing-delimiter handling, paragraph boundaries, linewise registers, undo, and dot-repeat.
  • Fix blank-line Visual selections, linewise paste cursor placement, and scalar-to-grapheme conversion uncovered by shared editor/textarea parity coverage.
  • Register the default keybindings and command labels, update the shortcut reference and docs/VIM_COMPATIBILITY.md, and add focused motion, editing, register, Unicode, and embedded-textarea regressions.

How to Test

  1. Open text containing several paragraphs separated by both empty lines and whitespace-only lines. Press {, }, and 2}; verify that only genuinely empty lines are paragraph boundaries. Exercise d}, y}p, and v}x and confirm their deletion, paste, register, and blank-line selection behavior matches Neovim.
  2. Open One. Two! Three? End, then exercise (, ), 2), dis, das, d3is, v2is, dot-repeat, and undo. Verify sentence punctuation and surrounding whitespace are preserved or consumed according to the selected motion/object.
  3. Repeat representative motions and operators in an embedded Agent composer. Include accented text, combining marks, and a family emoji; confirm cursor positions and editing results match the main file editor.
  4. Run cargo test -p red --test movement --test editing --test modal_textarea and verify all editor, sentence/paragraph, register-shape, Unicode, and embedded-textarea parity regressions pass.

@fcoury
fcoury force-pushed the fcoury/vim-paragraph-sentence-motions branch from e734377 to ed6e416 Compare August 21, 2026 22:06
@fcoury-oai
fcoury-oai merged commit 816abab into main Aug 21, 2026
11 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/vim-paragraph-sentence-motions branch August 21, 2026 22:11
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