forked from extern/nushell
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:
parent
4fd73ef54a
commit
d18f34daa4
@ -543,6 +543,15 @@ pub(crate) fn create_keybindings(config: &Config) -> Result<KeybindingsMode, She
|
|||||||
let mut insert_keybindings = default_vi_insert_keybindings();
|
let mut insert_keybindings = default_vi_insert_keybindings();
|
||||||
let mut normal_keybindings = default_vi_normal_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 {
|
for keybinding in parsed_keybindings {
|
||||||
add_keybinding(
|
add_keybinding(
|
||||||
&keybinding.mode,
|
&keybinding.mode,
|
||||||
@ -555,20 +564,11 @@ pub(crate) fn create_keybindings(config: &Config) -> Result<KeybindingsMode, She
|
|||||||
}
|
}
|
||||||
|
|
||||||
match config.edit_mode.as_str() {
|
match config.edit_mode.as_str() {
|
||||||
"emacs" => {
|
"emacs" => Ok(KeybindingsMode::Emacs(emacs_keybindings)),
|
||||||
add_menu_keybindings(&mut emacs_keybindings);
|
_ => Ok(KeybindingsMode::Vi {
|
||||||
|
|
||||||
Ok(KeybindingsMode::Emacs(emacs_keybindings))
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
add_menu_keybindings(&mut insert_keybindings);
|
|
||||||
add_menu_keybindings(&mut normal_keybindings);
|
|
||||||
|
|
||||||
Ok(KeybindingsMode::Vi {
|
|
||||||
insert_keybindings,
|
insert_keybindings,
|
||||||
normal_keybindings,
|
normal_keybindings,
|
||||||
})
|
}),
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user