Add inclusive vs exclusive motions to vim mode

This commit is contained in:
Keith Simmons 2022-04-21 16:14:58 -07:00
parent 0c587ae73c
commit 5ea782de21
11 changed files with 1350 additions and 750 deletions

View file

@ -1,10 +1,11 @@
#[cfg(test)]
mod vim_test_context;
mod editor_events;
mod insert;
mod motion;
mod normal;
mod state;
#[cfg(test)]
mod vim_test_context;
use collections::HashMap;
use editor::{CursorShape, Editor};
@ -25,6 +26,7 @@ impl_actions!(vim, [SwitchMode, PushOperator]);
pub fn init(cx: &mut MutableAppContext) {
editor_events::init(cx);
normal::init(cx);
insert::init(cx);
motion::init(cx);
@ -142,14 +144,14 @@ mod test {
#[gpui::test]
async fn test_initially_disabled(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, false, "").await;
let mut cx = VimTestContext::new(cx, false).await;
cx.simulate_keystrokes(["h", "j", "k", "l"]);
cx.assert_editor_state("hjkl|");
}
#[gpui::test]
async fn test_toggle_through_settings(cx: &mut gpui::TestAppContext) {
let mut cx = VimTestContext::new(cx, true, "").await;
let mut cx = VimTestContext::new(cx, true).await;
cx.simulate_keystroke("i");
assert_eq!(cx.mode(), Mode::Insert);