aboutsummaryrefslogtreecommitdiffstats
path: root/atuin-client/src/settings.rs
diff options
context:
space:
mode:
authorKoichi Murase <myoga.murase@gmail.com>2024-01-16 22:35:10 +0900
committerGitHub <noreply@github.com>2024-01-16 13:35:10 +0000
commit6bff8c8e1ad3a230f3cd8f5d7078ed2af3f43463 (patch)
treefa9ca6ee52cb5c100716b764b60453d157e681d8 /atuin-client/src/settings.rs
parentfeat: add history rebuild (#1575) (diff)
downloadatuin-6bff8c8e1ad3a230f3cd8f5d7078ed2af3f43463.zip
feat(search): introduce keymap-dependent vim-mode (#1570)
* feat(search): introduce keymap-dependent vim-mode * fix(zsh): provide widgets with specific keymaps * fix(settings): unify "vim" and "keymap_mode"
Diffstat (limited to 'atuin-client/src/settings.rs')
-rw-r--r--atuin-client/src/settings.rs30
1 files changed, 28 insertions, 2 deletions
diff --git a/atuin-client/src/settings.rs b/atuin-client/src/settings.rs
index ea01961c..36bbd826 100644
--- a/atuin-client/src/settings.rs
+++ b/atuin-client/src/settings.rs
@@ -143,6 +143,32 @@ pub enum WordJumpMode {
Subl,
}
+#[derive(Clone, Debug, Deserialize, Copy, PartialEq, Eq, ValueEnum)]
+pub enum KeymapMode {
+ #[serde(rename = "emacs")]
+ Emacs,
+
+ #[serde(rename = "vim-normal")]
+ VimNormal,
+
+ #[serde(rename = "vim-insert")]
+ VimInsert,
+
+ #[serde(rename = "auto")]
+ Auto,
+}
+
+impl KeymapMode {
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ KeymapMode::Emacs => "EMACS",
+ KeymapMode::VimNormal => "VIMNORMAL",
+ KeymapMode::VimInsert => "VIMINSERT",
+ KeymapMode::Auto => "AUTO",
+ }
+ }
+}
+
#[derive(Clone, Debug, Deserialize)]
pub struct Stats {
#[serde(default = "Stats::common_prefix_default")]
@@ -201,7 +227,7 @@ pub struct Settings {
pub max_preview_height: u16,
pub show_help: bool,
pub exit_mode: ExitMode,
- pub vim: bool,
+ pub keymap_mode: KeymapMode,
pub word_jump_mode: WordJumpMode,
pub word_chars: String,
pub scroll_context_lines: usize,
@@ -437,7 +463,7 @@ impl Settings {
// New users will get the new default, that is more similar to what they are used to.
.set_default("enter_accept", false)?
.set_default("sync.records", false)?
- .set_default("vim", false)?
+ .set_default("keymap_mode", "emacs")?
.add_source(
Environment::with_prefix("atuin")
.prefix_separator("_")