Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

vim: Allow up/down/left/right in vim mode

Conrad Irwind6b1af6244f5
diff --git a/assets/keymaps/vim.json b/assets/keymaps/vim.json
index 47c5f8c4585..74625b1ea81 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 0214806e119..2ee3c854353 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");
+}