Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim :s without g still replaces all matches #24450

Open
mattfbacon opened this issue Feb 7, 2025 · 3 comments
Open

Vim :s without g still replaces all matches #24450

mattfbacon opened this issue Feb 7, 2025 · 3 comments
Labels

Comments

@mattfbacon
Copy link
Contributor

mattfbacon commented Feb 7, 2025

Summary

Using :s without g replaces all matches in the line as if g was used.

Steps to trigger the problem:

  1. Enable vim mode.
  2. Do a replacement like :s/a/b

Actual Behavior:
All occurrences of a on the line are replaced with b.

Expected Behavior:
Only the first occurrence is replaced with b.

Zed Version and System Specs

Zed: v0.174.0 (Zed Dev b7244af0938bf8eb85c55301aae347f6eb73fbb1)
OS: Linux Wayland arch unknown
Memory: 31.1 GiB
Architecture: x86_64
GPU: Intel(R) Iris(R) Xe Graphics (ADL GT2) || Intel open-source Mesa driver || Mesa 24.3.4-arch1.1.1
@ConradIrwin
Copy link
Member

👍 This is known; I don't think it'd be too hard to fix, but we need to wire some extra state through the replace code.

https://cal.com/conradirwin/pairing if you want to work on it with me.

@notpeter notpeter added the vim label Feb 7, 2025
@mattfbacon
Copy link
Contributor Author

I can do it myself, I just have one question, where do we want to accommodate this in Zed? Is it another search option like regex, case sensitive, and whole word, or something else?

@ConradIrwin
Copy link
Member

I think we'd have to put it as an option in the buffer search. I don't know that we need a UI way to turn it on, but we probably do need some kind of indicator if it is in the "only the first on one line" mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants