Adding parentheses will create extra spaces
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Environment
Zed: v0.165.0 (Zed Dev 3019960f83e6852a5b9ce3706f88addce3aa2983) OS: Windows 10.0.19045 Memory: 15.7 GiB Architecture: x86_64 GPU: Intel(R) Iris(R) Xe Graphics || Intel Corporation || 101.5972
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
No response
Experiencing this issue too in vim mode with any kind of parentheses when using ysw[
This is still an issue currently: In |foo bar, with | denoting the curser position, pressing ysw) in Vim mode results in (foo )bar instead of the expected (foo) bar.
From what i've seen, this is intentional, you have to use the closing bracket if you don't want extra spaces.
Also correct me if i'm wrong, but i'm pretty sure the example @dominiklohmann sent is also intentional, and you should use ysiw instead if you don't want it to account for the extra spaces.
https://github.com/zed-industries/zed/blob/main/crates/vim/src/surrounds.rs#L90-L97
Not sure what you mean with "normal Vim behavior," because there is no such thing as ys in Vim OOTB. The most commonly used plugin for this is tpope/vim-surround, which has the behavior I described.
If I "surround a word" (ysw) with anything, I don't usually want to include something that's not part of the word.
Not sure what you mean with "normal Vim behavior," because there is no such thing as
ysin Vim OOTB. The most commonly used plugin for this istpope/vim-surround, which has the behavior I described.If I "surround a word" (
ysw) with anything, I don't usually want to include something that's not part of the word.
Correct, i should've pointed that out when i said "Normal Vim Behavior".
And you should use ysiw instead if that's what your looking to do, i'm unsure if they want this to be changed or not, i would be willing to submit a PR that could potentially fix that issue and make it behave the same as tpope/vim-surround.
I see your point, but I respectfully disagree because I do not think that the behavior you're suggesting is ever useful for the user.
I would argue that going from foo bar to "foo "bar is never what the user intended if they used ysw". To do that, a user should need to use the more explicit ysf<space>" or similar.
I see your point, but I respectfully disagree because I do not think that the behavior you're suggesting is ever useful for the user.
I would argue that going from
foo barto"foo "baris never what the user intended if they usedysw". To do that, a user should need to use the more explicitysf<space>"or similar.
I would agree, and i would be willing to attempt to fix that, but the main concern for me is the fact that they might've intentionally done this for one reason or another, maybe someone from the Zed team could clear up the confusion.
Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!
This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue.