From d6b1af6244f5658adb798e3619208164dc03bb1d Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 21 Jun 2023 14:02:32 -0600 Subject: [PATCH 1/2] vim: Allow up/down/left/right in vim mode The user impact of this is to 5 to move 5 lines at a time. --- assets/keymaps/vim.json | 4 ++++ crates/vim/src/test.rs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 47c5f8c458..74625b1ea8 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -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", diff --git a/crates/vim/src/test.rs b/crates/vim/src/test.rs index 0214806e11..2ee3c85435 100644 --- a/crates/vim/src/test.rs +++ b/crates/vim/src/test.rs @@ -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"); +} From 0c40ed5d854dfd53e2efa81f90a4918c34a5dac0 Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Wed, 21 Jun 2023 14:34:35 -0600 Subject: [PATCH 2/2] vim: ctrl+] and ctrl+o to jump to definition and back Equivalent to f12 and ctrl-- in non-vim mode. --- assets/keymaps/vim.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json index 74625b1ea8..e6fca1e28f 100644 --- a/assets/keymaps/vim.json +++ b/assets/keymaps/vim.json @@ -94,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": [ @@ -188,7 +190,6 @@ "p": "vim::Paste", "u": "editor::Undo", "ctrl-r": "editor::Redo", - "ctrl-o": "pane::GoBack", "/": [ "buffer_search::Deploy", {