diff --git a/docs/config_file_example.yaml b/docs/config_file_example.yaml index 8fa2f0c8..ae2706f9 100644 --- a/docs/config_file_example.yaml +++ b/docs/config_file_example.yaml @@ -17,6 +17,7 @@ finder: command: fzf # equivalent to the --finder option # overrides: --tac # equivalent to the --fzf-overrides option # overrides_var: --tac # equivalent to the --fzf-overrides-var option + # delimiter_var: \s\s+ # equivalent to the --delimiter option that is used with --column option when you extract a column from the selected result for a variable # cheats: # paths: diff --git a/src/config/mod.rs b/src/config/mod.rs index a5d1e4ae..cc788da1 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -99,6 +99,10 @@ impl Config { .or_else(|| self.yaml.finder.overrides_var.clone()) } + pub fn delimiter_var(&self) -> Option { + self.yaml.finder.delimiter_var.clone() + } + pub fn tealdeer(&self) -> bool { self.yaml.client.tealdeer } diff --git a/src/config/yaml.rs b/src/config/yaml.rs index 868411bf..796d3f61 100644 --- a/src/config/yaml.rs +++ b/src/config/yaml.rs @@ -47,6 +47,7 @@ pub struct Finder { pub command: FinderChoice, pub overrides: Option, pub overrides_var: Option, + pub delimiter_var: Option, } fn finder_deserialize<'de, D>(deserializer: D) -> Result @@ -158,6 +159,7 @@ impl Default for Finder { command: FinderChoice::Fzf, overrides: None, overrides_var: None, + delimiter_var: None, } } } diff --git a/src/finder/structures.rs b/src/finder/structures.rs index a0551949..4b6726b8 100644 --- a/src/finder/structures.rs +++ b/src/finder/structures.rs @@ -66,6 +66,7 @@ impl Opts { overrides: CONFIG.fzf_overrides_var(), suggestion_type: SuggestionType::SingleRecommendation, prevent_select1: false, + delimiter: CONFIG.delimiter_var(), ..Default::default() } }