vim: Rename wrapping keybindings + document cursor wrapping (#25694)

https://github.com/zed-industries/zed/pull/25663#issuecomment-2686095807

Renamed the `vim::Backspace` and `vim::Space` actions to
`vim::WrappingLeft` and `vim::WrappingRight` respectively. The old names
are still available, but they are marked as deprecated and users are
advised to use the new names.

Also added a paragraph to the docs describing how to enable wrapping
cursor navigation.
This commit is contained in:
Asqar Arslanov 2025-03-05 18:54:30 +03:00 committed by GitHub
parent 2d050a8130
commit 3975d8ea93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 49 additions and 22 deletions

View file

@ -408,6 +408,22 @@ Vim mode comes with shortcuts to surround the selection in normal mode (`ys`), b
}
```
In non-modal text editors, cursor navigation typically wraps when moving past line ends. Zed, however, handles this behavior exactly like Vim by default: the cursor stops at line boundaries. If you prefer your cursor to wrap between lines, override these keybindings:
```json
// In VimScript, this would look like this:
// set whichwrap+=<,>,[,],h,l
{
"context": "VimControl && !menu",
"bindings": {
"left": "vim::WrappingLeft",
"right": "vim::WrappingRight",
"h": "vim::WrappingLeft",
"l": "vim::WrappingRight"
}
}
```
The [Sneak motion](https://github.com/justinmk/vim-sneak) feature allows for quick navigation to any two-character sequence in your text. You can enable it by adding the following keybindings to your keymap. By default, the `s` key is mapped to `vim::Substitute`. Adding these bindings will override that behavior, so ensure this change aligns with your workflow preferences.
```json