diff options
| author | sigoden <sigoden@gmail.com> | 2025-07-05 07:03:08 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-05 07:03:08 +0800 |
| commit | d0b499ed92a63dc9ca6264724b4749c4384c91e3 (patch) | |
| tree | 2efe627430edd0c85ab0e1e273e5fc825afb1de2 | |
| parent | 8832484272002b4f0f23333523b360ee967b6be9 (diff) | |
| download | aichat-d0b499ed92a63dc9ca6264724b4749c4384c91e3.tar.gz | |
feat: ctrl+j for newline (#1342)
| -rw-r--r-- | src/repl/mod.rs | 9 |
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); |
