diff --git a/crates/modalkit/src/env/vim/keybindings.rs b/crates/modalkit/src/env/vim/keybindings.rs index 8d191eb..47c8a37 100644 --- a/crates/modalkit/src/env/vim/keybindings.rs +++ b/crates/modalkit/src/env/vim/keybindings.rs @@ -1859,12 +1859,15 @@ fn default_enter() -> Vec<(MappedModes, &'static str, InputS [ // in Normal, Visual, and Operator-Pending mode moves to next line. ( MAP, "", edit_end!(MoveType::FirstWord(MoveDir1D::Next)) ), + ( MAP, "", edit_end!(MoveType::FirstWord(MoveDir1D::Next)) ), // in Insert mode types a newlines. ( IMAP, "", chartype!(Char::Single('\n')) ), + ( IMAP, "", chartype!(Char::Single('\n')) ), // in Command mode submits the command. ( CMAP, "", command_exit!(PromptAction::Submit) ), + ( CMAP, "", command_exit!(PromptAction::Submit) ), ].to_vec() } @@ -1892,12 +1895,18 @@ fn submit_on_enter(insert_mode_newline: bool) -> Vec<(Mapped let mut mappings = [ // in Normal and Visual mode submits contents. ( NVMAP, "", prompt!(PromptAction::Submit, VimMode::Normal) ), + ( NVMAP, "", prompt!(PromptAction::Submit, VimMode::Normal) ), // in Command mode submits the command. ( CMAP, "", command_exit!(PromptAction::Submit) ), + ( CMAP, "", command_exit!(PromptAction::Submit) ), // in Operator-Pending mode moves to the next line. ( OMAP, "", edit_end!(MoveType::FirstWord(MoveDir1D::Next)) ), + ( OMAP, "", edit_end!(MoveType::FirstWord(MoveDir1D::Next)) ), + + // in Insert mode always submits contents and stays in Insert mode. + ( IMAP, "", prompt!(PromptAction::Submit, VimMode::Insert) ) ].to_vec(); let imap = if insert_mode_newline {