1
1
mirror of https://github.com/ellie/atuin.git synced 2024-10-26 23:29:51 +03:00

feat(tui): configurable prefix character (#2157)

* feat(tui): configurable prefix character

* string not char because toml/json lol
This commit is contained in:
Ellie Huxtable 2024-06-18 10:24:43 +01:00 committed by GitHub
parent 4dd76d84ed
commit 7984f9ef0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -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())?

View File

@ -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;
}