diff options
author | Steven Xu <stevenxxiu@users.noreply.github.com> | 2023-03-06 05:49:09 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-05 18:49:09 +0000 |
commit | 2e79e73af32793f7fe103b81246a5ef5a6e1cfbe (patch) | |
tree | 1916278c4aa294f5fca3b7bcf29802eecf81e1fa /atuin-client | |
parent | 3eb50a8383e65379eddf0edd8dc73431ee8080ff (diff) |
feat: add common default keybindings (#719)
* feat: add common default keybindings
* feat: add `WORD_SEPARATORS` to config as `word_chars`, as this is what *Zsh* calls it
* feat: add option for *Emacs* word jumping
* feat: scroll with `PageUp` and `PageDown`, cf #374
Diffstat (limited to 'atuin-client')
-rw-r--r-- | atuin-client/config.toml | 9 | ||||
-rw-r--r-- | atuin-client/src/settings.rs | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/atuin-client/config.toml b/atuin-client/config.toml index 0c9b4ede2..a3c255b61 100644 --- a/atuin-client/config.toml +++ b/atuin-client/config.toml @@ -38,6 +38,15 @@ ## possible values: return-original, return-query # exit_mode = "return-original" +## possible values: emacs, subl +# word_jump_mode = "emacs" + +## characters that count as a part of a word +# word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +## number of context lines to show when scrolling by pages +# scroll_context_lines = 1 + ## prevent commands matching any of these regexes from being written to history. ## Note that these regular expressions are unanchored, i.e. if they don't start ## with ^ or end with $, they'll match anywhere in the command. diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs index 6b642b789..bd47d5aa1 100644 --- a/atuin-client/src/settings.rs +++ b/atuin-client/src/settings.rs @@ -97,6 +97,15 @@ pub enum Style { Compact, } +#[derive(Clone, Debug, Deserialize, Copy)] +pub enum WordJumpMode { + #[serde(rename = "emacs")] + Emacs, + + #[serde(rename = "subl")] + Subl, +} + #[derive(Clone, Debug, Deserialize)] pub struct Settings { pub dialect: Dialect, @@ -114,6 +123,9 @@ pub struct Settings { pub shell_up_key_binding: bool, pub show_preview: bool, pub exit_mode: ExitMode, + pub word_jump_mode: WordJumpMode, + pub word_chars: String, + pub scroll_context_lines: usize, #[serde(with = "serde_regex", default = "RegexSet::empty")] pub history_filter: RegexSet, @@ -300,6 +312,12 @@ impl Settings { .set_default("exit_mode", "return-original")? .set_default("session_token", "")? .set_default("style", "auto")? + .set_default("word_jump_mode", "emacs")? + .set_default( + "word_chars", + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", + )? + .set_default("scroll_context_lines", 1)? .add_source( Environment::with_prefix("atuin") .prefix_separator("_") |