vim: Add support for temporary normal mode (ctrl-o) within insert mode (#19454)
Support has been added for the ctrl-o command within insert mode. Ctrl-o is used to partially enter normal mode for 1 motion to then return back into insert mode. Release Notes: - vim: Added support for `ctrl-o` in insert mode to enter temporary normal mode --------- Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
254ce74036
commit
b1cd9e4d24
14 changed files with 145 additions and 11 deletions
|
@ -1570,3 +1570,36 @@ async fn test_sentence_forwards(cx: &mut gpui::TestAppContext) {
|
|||
|
||||
cx.set_shared_state("helˇlo.\n\n\nworld.").await;
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_ctrl_o_visual(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.set_shared_state("helloˇ world.").await;
|
||||
cx.simulate_shared_keystrokes("i ctrl-o v b r l").await;
|
||||
cx.shared_state().await.assert_eq("ˇllllllworld.");
|
||||
cx.simulate_shared_keystrokes("ctrl-o v f w d").await;
|
||||
cx.shared_state().await.assert_eq("ˇorld.");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_ctrl_o_position(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.set_shared_state("helˇlo world.").await;
|
||||
cx.simulate_shared_keystrokes("i ctrl-o d i w").await;
|
||||
cx.shared_state().await.assert_eq("ˇ world.");
|
||||
cx.simulate_shared_keystrokes("ctrl-o p").await;
|
||||
cx.shared_state().await.assert_eq(" helloˇworld.");
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_ctrl_o_dot(cx: &mut gpui::TestAppContext) {
|
||||
let mut cx = NeovimBackedTestContext::new(cx).await;
|
||||
|
||||
cx.set_shared_state("heˇllo world.").await;
|
||||
cx.simulate_shared_keystrokes("x i ctrl-o .").await;
|
||||
cx.shared_state().await.assert_eq("heˇo world.");
|
||||
cx.simulate_shared_keystrokes("l l escape .").await;
|
||||
cx.shared_state().await.assert_eq("hellˇllo world.");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue