From 066790552a796feceb88906e42dbd2de09ea50f2 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sun, 6 Aug 2023 06:59:06 -0500 Subject: [PATCH] add keybinding for search-history (#9930) # Description This PR adds a keybinding in the rust code for `search-history` aka reverse-search as `ctrl+q` so it does not overwrite `history-search` with `ctrl+r` as it does now. This PR supercedes #9862. Thanks to @SUPERCILEX for bringing this to our attention. # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-cli/src/reedline_config.rs | 6 ++++++ crates/nu-utils/src/sample_config/default_config.nu | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/nu-cli/src/reedline_config.rs b/crates/nu-cli/src/reedline_config.rs index 525e9366da..8899e46d6f 100644 --- a/crates/nu-cli/src/reedline_config.rs +++ b/crates/nu-cli/src/reedline_config.rs @@ -523,6 +523,12 @@ fn add_menu_keybindings(keybindings: &mut Keybindings) { KeyCode::F(1), ReedlineEvent::Menu("help_menu".to_string()), ); + + keybindings.add_binding( + KeyModifiers::CONTROL, + KeyCode::Char('q'), + ReedlineEvent::SearchHistory, + ); } pub enum KeybindingsMode { diff --git a/crates/nu-utils/src/sample_config/default_config.nu b/crates/nu-utils/src/sample_config/default_config.nu index 2710724301..29e8565214 100644 --- a/crates/nu-utils/src/sample_config/default_config.nu +++ b/crates/nu-utils/src/sample_config/default_config.nu @@ -392,7 +392,7 @@ $env.config = { { name: search_history modifier: control - keycode: char_r + keycode: char_q mode: [emacs, vi_normal, vi_insert] event: { send: searchhistory } }