mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
vim: binding fixes (#2637)
Release Notes: - In vim mode you can now use count modifiers with arrow keys (`5<down>` will go down 5 lines). - In vim mode `ctrl+]` and `ctrl+o` now work to go to definition and back
This commit is contained in:
commit
ea5398a702
2 changed files with 17 additions and 1 deletions
|
@ -25,11 +25,15 @@
|
|||
}
|
||||
],
|
||||
"h": "vim::Left",
|
||||
"left": "vim::Left",
|
||||
"backspace": "vim::Backspace",
|
||||
"j": "vim::Down",
|
||||
"down": "vim::Down",
|
||||
"enter": "vim::NextLineStart",
|
||||
"k": "vim::Up",
|
||||
"up": "vim::Up",
|
||||
"l": "vim::Right",
|
||||
"right": "vim::Right",
|
||||
"$": "vim::EndOfLine",
|
||||
"shift-g": "vim::EndOfDocument",
|
||||
"w": "vim::NextWordStart",
|
||||
|
@ -90,6 +94,8 @@
|
|||
}
|
||||
}
|
||||
],
|
||||
"ctrl-o": "pane::GoBack",
|
||||
"ctrl-]": "editor::GoToDefinition",
|
||||
"escape": "editor::Cancel",
|
||||
"0": "vim::StartOfLine", // When no number operator present, use start of line motion
|
||||
"1": [
|
||||
|
@ -185,7 +191,6 @@
|
|||
"p": "vim::Paste",
|
||||
"u": "editor::Undo",
|
||||
"ctrl-r": "editor::Redo",
|
||||
"ctrl-o": "pane::GoBack",
|
||||
"/": [
|
||||
"buffer_search::Deploy",
|
||||
{
|
||||
|
|
|
@ -98,3 +98,14 @@ async fn test_buffer_search(cx: &mut gpui::TestAppContext) {
|
|||
assert_eq!(bar.query_editor.read(cx).text(cx), "jumps");
|
||||
})
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_count_down(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = VimTestContext::new(cx, true).await;
|
||||
|
||||
cx.set_state(indoc! {"aˇa\nbb\ncc\ndd\nee"}, Mode::Normal);
|
||||
cx.simulate_keystrokes(["2", "down"]);
|
||||
cx.assert_editor_state("aa\nbb\ncˇc\ndd\nee");
|
||||
cx.simulate_keystrokes(["9", "down"]);
|
||||
cx.assert_editor_state("aa\nbb\ncc\ndd\neˇe");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue