Skip to content

Commit

Permalink
feat(tui): configurable prefix character (#2157)
Browse files Browse the repository at this point in the history
* feat(tui): configurable prefix character

* string not char because toml/json lol
  • Loading branch information
ellie authored Jun 18, 2024
1 parent 4dd76d8 commit 7984f9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/atuin-client/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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())?
Expand Down
2 changes: 1 addition & 1 deletion crates/atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7984f9e

Please sign in to comment.