From be86852f9595e915dd42ee385406a3bf97499bbd Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 26 Jul 2024 16:33:31 -0600 Subject: [PATCH] Allow binding to motions in insert mode (#15308) Release Notes: - vim: Allow binding motions in insert mode --- crates/vim/src/motion.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs index 0e501c838b..1df5762bb0 100644 --- a/crates/vim/src/motion.rs +++ b/crates/vim/src/motion.rs @@ -436,7 +436,7 @@ pub(crate) fn motion(motion: Motion, cx: &mut WindowContext) { let active_operator = Vim::read(cx).active_operator(); let mut waiting_operator: Option = None; match Vim::read(cx).state().mode { - Mode::Normal | Mode::Replace => { + Mode::Normal | Mode::Replace | Mode::Insert => { if active_operator == Some(Operator::AddSurrounds { target: None }) { waiting_operator = Some(Operator::AddSurrounds { target: Some(SurroundsType::Motion(motion)), @@ -448,9 +448,6 @@ pub(crate) fn motion(motion: Motion, cx: &mut WindowContext) { Mode::Visual | Mode::VisualLine | Mode::VisualBlock => { visual_motion(motion.clone(), count, cx) } - Mode::Insert => { - // Shouldn't execute a motion in insert mode. Ignoring - } } Vim::update(cx, |vim, cx| { vim.clear_operator(cx);