Allow overriding of menu keybindings (#5148)

Keybindings that were attached to menus like `Ctrl-x` or `Ctrl-q` could not be replaced with custom bindings
This commit is contained in:
Stefan Holderbach 2022-04-10 22:48:55 +02:00 committed by GitHub
parent 4fd73ef54a
commit d18f34daa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -543,6 +543,15 @@ pub(crate) fn create_keybindings(config: &Config) -> Result<KeybindingsMode, She
let mut insert_keybindings = default_vi_insert_keybindings();
let mut normal_keybindings = default_vi_normal_keybindings();
match config.edit_mode.as_str() {
"emacs" => {
add_menu_keybindings(&mut emacs_keybindings);
}
_ => {
add_menu_keybindings(&mut insert_keybindings);
add_menu_keybindings(&mut normal_keybindings);
}
}
for keybinding in parsed_keybindings {
add_keybinding(
&keybinding.mode,
@ -555,20 +564,11 @@ pub(crate) fn create_keybindings(config: &Config) -> Result<KeybindingsMode, She
}
match config.edit_mode.as_str() {
"emacs" => {
add_menu_keybindings(&mut emacs_keybindings);
Ok(KeybindingsMode::Emacs(emacs_keybindings))
}
_ => {
add_menu_keybindings(&mut insert_keybindings);
add_menu_keybindings(&mut normal_keybindings);
Ok(KeybindingsMode::Vi {
insert_keybindings,
normal_keybindings,
})
}
"emacs" => Ok(KeybindingsMode::Emacs(emacs_keybindings)),
_ => Ok(KeybindingsMode::Vi {
insert_keybindings,
normal_keybindings,
}),
}
}