vim: Fix relative motions (#2888)
This changes vim motions to be relative to fold lines, not display lines, to match the behaviour of vim. This is necessary for relative line numbers to make sense (as the most important thing is you can do `3j` to get th e line that is numbered 3). Release Notes: - vim: Fix handling of motions when `soft_wrap` is enabled in zed. Like in vim `j,k,up,down,$,^,0,home,end` will all now navigate in file coordinates not display coordinates. - vim: Add `g {j,k,up,down,$,^,0,home,end}` to navigate in display coordinates. - vim: Add `z o` and `z c` to open and close folds. - vim: Add `z f` in visual mode to fold selection. Note: this may be a jarring change if you're grown used to the current behaviour of `j` and `k`. You can make the issue less acute by setting `"soft_wrap":"none"` in your settings; or you can manually copy the bindings for `g j` to the binding for `j` (etc.) in your keymap.json to preserve the existing behaviour.
This commit is contained in:
commit
dd577074f2
13 changed files with 698 additions and 77 deletions
|
@ -137,10 +137,67 @@
|
|||
"partialWord": true
|
||||
}
|
||||
],
|
||||
"g j": [
|
||||
"vim::Down",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g down": [
|
||||
"vim::Down",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g k": [
|
||||
"vim::Up",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g up": [
|
||||
"vim::Up",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g $": [
|
||||
"vim::EndOfLine",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g end": [
|
||||
"vim::EndOfLine",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g 0": [
|
||||
"vim::StartOfLine",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g home": [
|
||||
"vim::StartOfLine",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
"g ^": [
|
||||
"vim::FirstNonWhitespace",
|
||||
{
|
||||
"displayLines": true
|
||||
}
|
||||
],
|
||||
// z commands
|
||||
"z t": "editor::ScrollCursorTop",
|
||||
"z z": "editor::ScrollCursorCenter",
|
||||
"z b": "editor::ScrollCursorBottom",
|
||||
"z c": "editor::Fold",
|
||||
"z o": "editor::UnfoldLines",
|
||||
"z f": "editor::FoldSelectedRanges",
|
||||
// Count support
|
||||
"1": [
|
||||
"vim::Number",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue