From 3a685049da531526341c23a693f2f4eca32fda30 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:23:41 -0500 Subject: [PATCH] add `name` to `$env.config.keybindings` (#14159) # Description This PR adds the `name` column back to keybindings. This may be considered a hack since the reedline keybinding has no spot for name, but it seems to work. --- crates/nu-cli/src/reedline_config.rs | 4 ++++ crates/nu-protocol/src/config/reedline.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/crates/nu-cli/src/reedline_config.rs b/crates/nu-cli/src/reedline_config.rs index 1b09e59166..55179ab0ae 100644 --- a/crates/nu-cli/src/reedline_config.rs +++ b/crates/nu-cli/src/reedline_config.rs @@ -711,6 +711,7 @@ pub(crate) fn create_keybindings(config: &Config) -> Result Result, mode: &Value, keybinding: &ParsedKeybinding, config: &Config, @@ -752,6 +755,7 @@ fn add_keybinding( Value::List { vals, .. } => { for inner_mode in vals { add_keybinding( + name, inner_mode, keybinding, config, diff --git a/crates/nu-protocol/src/config/reedline.rs b/crates/nu-protocol/src/config/reedline.rs index 330998c202..1694619e99 100644 --- a/crates/nu-protocol/src/config/reedline.rs +++ b/crates/nu-protocol/src/config/reedline.rs @@ -5,6 +5,7 @@ use crate::{engine::Closure, FromValue}; /// Definition of a parsed keybinding from the config object #[derive(Clone, Debug, FromValue, IntoValue, Serialize, Deserialize)] pub struct ParsedKeybinding { + pub name: Option, pub modifier: Value, pub keycode: Value, pub event: Value,