Skip to content

vim: Fix cw with count greater than 1 not preserving whitespace correctly #56585

Open
davidhi7 wants to merge 2 commits into
zed-industries:mainfrom
davidhi7:fix/c2w
Open

vim: Fix cw with count greater than 1 not preserving whitespace correctly #56585
davidhi7 wants to merge 2 commits into
zed-industries:mainfrom
davidhi7:fix/c2w

Conversation

@davidhi7
Copy link
Copy Markdown

@davidhi7 davidhi7 commented May 12, 2026

In vim, c {count} w diverges from the default w motion behavior: For change operations, the w motion will be treated like the e motion if the cursor is on a word, preserving whitespace after the N-th word. In zed, this special case was only implemented for a count of 1, falling back to incorrectly using the w motion if the count is greater than 1.

This PR generalizes this implementation to handle this special case for any count.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Closes #56563.

Release Notes:

  • Fixed: vim cw with count greater than 1 not preserving whitespace correctly

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label May 12, 2026
@maxdeviant maxdeviant changed the title vim: cw with count greater than 1 not preserving whitespace correctly vim: Fix cw with count greater than 1 not preserving whitespace correctly May 12, 2026
@ChristopherBiscardi ChristopherBiscardi added the area:parity/vim Feedback for Vim parity features label May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:parity/vim Feedback for Vim parity features first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vim c 2 w deletes the trailing whitespace

2 participants