From 8548d1a1f1f7f6edae17c2962a7809bef3cde479 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Tue, 24 Sep 2024 10:03:46 -0400 Subject: [PATCH] fix: treat `CTRL + J` as `Enter` --- src/edit_mode/emacs.rs | 1 + src/edit_mode/vi/mod.rs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/edit_mode/emacs.rs b/src/edit_mode/emacs.rs index 773618fe..786b4eed 100644 --- a/src/edit_mode/emacs.rs +++ b/src/edit_mode/emacs.rs @@ -121,6 +121,7 @@ impl EditMode for Emacs { Event::Key(KeyEvent { code, modifiers, .. }) => match (modifiers, code) { + (KeyModifiers::CONTROL, KeyCode::Char('j')) => ReedlineEvent::Enter, (modifier, KeyCode::Char(c)) => { // Note. The modifier can also be a combination of modifiers, for // example: diff --git a/src/edit_mode/vi/mod.rs b/src/edit_mode/vi/mod.rs index dc3fcb0a..75646087 100644 --- a/src/edit_mode/vi/mod.rs +++ b/src/edit_mode/vi/mod.rs @@ -68,6 +68,10 @@ impl EditMode for Vi { self.mode = ViMode::Visual; ReedlineEvent::Multiple(vec![ReedlineEvent::Esc, ReedlineEvent::Repaint]) } + (_, KeyModifiers::CONTROL, KeyCode::Char('j')) => { + self.mode = ViMode::Insert; + ReedlineEvent::Enter + } (ViMode::Normal | ViMode::Visual, modifier, KeyCode::Char(c)) => { let c = c.to_ascii_lowercase();