diff options
author | Ellie Huxtable <ellie@elliehuxtable.com> | 2024-06-18 10:24:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-18 10:24:43 +0100 |
commit | 7984f9ef0c1824d4f2cffcb6e93cc951d3913be8 (patch) | |
tree | e4e5624a8ee02520c341136a0cc3a665bcd0f64a | |
parent | 4dd76d84ed0c1789d9acc66d4304eda18a0ed4ac (diff) |
feat(tui): configurable prefix character (#2157)
* feat(tui): configurable prefix character
* string not char because toml/json lol
-rw-r--r-- | crates/atuin-client/src/settings.rs | 2 | ||||
-rw-r--r-- | crates/atuin/src/command/client/search/interactive.rs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/crates/atuin-client/src/settings.rs b/crates/atuin-client/src/settings.rs index c0ead292f..a34758db3 100644 --- a/crates/atuin-client/src/settings.rs +++ b/crates/atuin-client/src/settings.rs @@ -330,6 +330,7 @@ pub struct Sync { #[derive(Clone, Debug, Deserialize, Default, Serialize)] pub struct Keys { pub scroll_exits: bool, + pub prefix: String, } #[derive(Clone, Debug, Deserialize, Serialize)] @@ -715,6 +716,7 @@ impl Settings { .set_default("enter_accept", false)? .set_default("sync.records", false)? .set_default("keys.scroll_exits", true)? + .set_default("keys.prefix", "a")? .set_default("keymap_mode", "emacs")? .set_default("keymap_mode_shell", "auto")? .set_default("keymap_cursor", HashMap::<String, String>::new())? diff --git a/crates/atuin/src/command/client/search/interactive.rs b/crates/atuin/src/command/client/search/interactive.rs index 9185bc0f2..de0f4ea12 100644 --- a/crates/atuin/src/command/client/search/interactive.rs +++ b/crates/atuin/src/command/client/search/interactive.rs @@ -204,7 +204,7 @@ impl State { let esc_allow_exit = !(self.tab_index == 0 && self.keymap_mode == KeymapMode::VimInsert); // support ctrl-a prefix, like screen or tmux - if ctrl && input.code == KeyCode::Char('a') { + if ctrl && input.code == KeyCode::Char(settings.keys.prefix.chars().next().unwrap_or('a')) { self.prefix = true; return InputAction::Continue; } |