Skip to content

Conversation

@AidanV
Copy link
Contributor

@AidanV AidanV commented Jan 8, 2026

This PR aims to fix a bug with :norm that disallowed trailing whitespace.

Previous Zed behavior:
norm_bug

Neovim behavior:
norm_bug_neovim
Thank you to @woza4961 in the Zed Discord for the GIFs!

Zed's behavior now matches Neovim's.

I decided to let Commands that accept generic args (i.e. commands defined with the args function) to handle trailing whitespace themselves, and those that accept filenames (i.e. commands defined with the filename function) to have whitespace pre-trimmed. This allows for us to ignore it in the general case (filenames) and only care about whitespace when we want to do something special like :norm.

The only other Command that calls the args function is :delmarks which is not affected by this change since marks cannot be whitespace.

Release Notes:

  • vim: Fixed :norm command to preserve trailing whitespace in arguments (e.g., :norm I now correctly inserts two spaces)
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 8, 2026
@github-actions github-actions bot added the community champion Issues filed by our amazing community champions! 🫶 label Jan 8, 2026
@Wozacosta
Copy link

Thanks a lot for handling this!

- Update `args()` and `filename()` doc comments to accurately describe
  their effect on whitespace handling
- Flatten nested if/else in `parse()` to an if/else if/else chain
@dinocosta
Copy link
Member

Thank you @AidanV ! 🎉

@dinocosta dinocosta enabled auto-merge (squash) January 12, 2026 16:29
@dinocosta dinocosta merged commit d2b31b4 into zed-industries:main Jan 13, 2026
36 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement community champion Issues filed by our amazing community champions! 🫶

3 participants