summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-07-05 07:03:08 +0800
committerGitHub <noreply@github.com>2025-07-05 07:03:08 +0800
commitd0b499ed92a63dc9ca6264724b4749c4384c91e3 (patch)
tree2efe627430edd0c85ab0e1e273e5fc825afb1de2 /src
parent8832484272002b4f0f23333523b360ee967b6be9 (diff)
downloadaichat-d0b499ed92a63dc9ca6264724b4749c4384c91e3.tar.gz
feat: ctrl+j for newline (#1342)
Diffstat (limited to 'src')
-rw-r--r--src/repl/mod.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs
index d8dcb06..2332569 100644
--- a/src/repl/mod.rs
+++ b/src/repl/mod.rs
@@ -310,15 +310,18 @@ Type ".help" for additional help.
KeyCode::Enter,
ReedlineEvent::Edit(vec![EditCommand::InsertNewline]),
);
+ keybindings.add_binding(
+ KeyModifiers::CONTROL,
+ KeyCode::Char('j'),
+ ReedlineEvent::Edit(vec![EditCommand::InsertNewline]),
+ );
}
fn create_edit_mode(config: &GlobalConfig) -> Box<dyn EditMode> {
let edit_mode: Box<dyn EditMode> = if config.read().keybindings == "vi" {
- let mut normal_keybindings = default_vi_normal_keybindings();
let mut insert_keybindings = default_vi_insert_keybindings();
- Self::extra_keybindings(&mut normal_keybindings);
Self::extra_keybindings(&mut insert_keybindings);
- Box::new(Vi::new(insert_keybindings, normal_keybindings))
+ Box::new(Vi::new(insert_keybindings, default_vi_normal_keybindings()))
} else {
let mut keybindings = default_emacs_keybindings();
Self::extra_keybindings(&mut keybindings);