mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 19:17:44 +02:00
Add send: vichangemode
to reedline config (#16327)
# Description Allows custom bindings (non-chord) to send a `edit_mode: vi` mode change via the new `ReedlineEvent::ViChangeMode` Takes https://github.com/nushell/reedline/pull/932 # User-Facing Changes You can now set bindings which change the Vi mode. (This still has the same rules for defining the key-combination: Only modifiers and single keys are supported) To do so send a `vichangemode` event with the `mode` field to set `normal`, `insert`, or `visual` ```nushell $env.config.keybindings ++= [{ name: modechangetest modifier: control keycode: "char_[" mode: [vi_normal, vi_insert] event: {send: vichangemode, mode: normal} }] ```
This commit is contained in:
committed by
GitHub
parent
2c9f6acc03
commit
dfbd98013d
@ -1047,6 +1047,10 @@ fn event_from_record(
|
||||
ReedlineEvent::ExecuteHostCommand(cmd.to_expanded_string("", config))
|
||||
}
|
||||
"openeditor" => ReedlineEvent::OpenEditor,
|
||||
"vichangemode" => {
|
||||
let mode = extract_value("mode", record, span)?;
|
||||
ReedlineEvent::ViChangeMode(mode.as_str()?.to_owned())
|
||||
}
|
||||
str => {
|
||||
return Err(ShellError::InvalidValue {
|
||||
valid: "a reedline event".into(),
|
||||
|
Reference in New Issue
Block a user