This commit is contained in:
Mikhail Kilin
2026-02-13 19:52:53 +03:00
parent 6d08300daa
commit 6639dc876c
38 changed files with 961 additions and 123 deletions

View File

@@ -65,6 +65,9 @@ pub enum Command {
MoveToStart,
MoveToEnd,
// Vim mode
EnterInsertMode,
// Profile
OpenProfile,
}
@@ -100,6 +103,13 @@ impl KeyBinding {
}
}
pub fn with_alt(key: KeyCode) -> Self {
Self {
key,
modifiers: KeyModifiers::ALT,
}
}
pub fn matches(&self, event: &KeyEvent) -> bool {
self.key == event.code && self.modifiers == event.modifiers
}
@@ -234,9 +244,7 @@ impl Keybindings {
bindings.insert(Command::Cancel, vec![
KeyBinding::new(KeyCode::Esc),
]);
bindings.insert(Command::NewLine, vec![
KeyBinding::with_shift(KeyCode::Enter),
]);
bindings.insert(Command::NewLine, vec![]);
bindings.insert(Command::DeleteChar, vec![
KeyBinding::new(KeyCode::Backspace),
]);
@@ -253,6 +261,12 @@ impl Keybindings {
KeyBinding::with_ctrl(KeyCode::Char('e')),
]);
// Vim mode
bindings.insert(Command::EnterInsertMode, vec![
KeyBinding::new(KeyCode::Char('i')),
KeyBinding::new(KeyCode::Char('ш')), // RU
]);
// Profile
bindings.insert(Command::OpenProfile, vec![
KeyBinding::with_ctrl(KeyCode::Char('u')), // Ctrl+U instead of Ctrl+I