vim: Add :set wrap and :set nowrap #24059
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #21147
Hi! This is my first pull request. I found this issue from the vim channel notes, and thought it was an appropriate first contribution, to try and understand things here. I hope I did it all correctly! I didn't find any tests for soft wrapping, so I have not made or edited any.
The original issue requested that
set wrap
toggle the soft wrap state. That's not what Vim does, so that's not what I've done. Instead, I've added separate:set wrap
and:set nowrap
commands.I tried a few different things out here, including adding separate
EnableSoftWrap
andDisableSoftWrap
actions, and convertingeditor::set_soft_wrap_mode()
to an action. In the end I chose an optional parameter to the existing action to be the lowest touch change here.These are (I think) the first
:set ...
commands added to the Vim mode in Zed, unless I've missed something. If there is a desire for more of these (number
,relativenumber
,shiftwidth
, et al), I would be happy to contribute those as well. And, if this is not the correct way to have added such an option, please also let me know.Thanks,
Max.
Release Notes:
:set wrap
and:set nowrap
to enable and disablesoft_wrap