diff --git a/yazi-config/preset/yazi.toml b/yazi-config/preset/yazi.toml index c36417e2..521f4856 100644 --- a/yazi-config/preset/yazi.toml +++ b/yazi-config/preset/yazi.toml @@ -189,6 +189,7 @@ sort_by = "none" sort_sensitive = false sort_reverse = false sort_translit = false +emit_unique = true [log] enabled = false diff --git a/yazi-config/src/which/which.rs b/yazi-config/src/which/which.rs index 205a2bc4..0da8b7b1 100644 --- a/yazi-config/src/which/which.rs +++ b/yazi-config/src/which/which.rs @@ -12,6 +12,8 @@ pub struct Which { pub sort_sensitive: bool, pub sort_reverse: bool, pub sort_translit: bool, + // emit + pub emit_unique: bool, } impl FromStr for Which { diff --git a/yazi-core/src/which/which.rs b/yazi-core/src/which/which.rs index 7791263d..ca69d08a 100644 --- a/yazi-core/src/which/which.rs +++ b/yazi-core/src/which/which.rs @@ -1,4 +1,4 @@ -use yazi_config::keymap::{ControlCow, Key}; +use yazi_config::{keymap::{ControlCow, Key}, WHICH}; use yazi_shared::{emit, render, render_and, Layer}; #[derive(Default)] @@ -19,7 +19,7 @@ impl Which { if self.cands.is_empty() { self.reset(); - } else if self.cands.len() == 1 { + } else if self.cands.len() == 1 && WHICH.emit_unique { emit!(Seq(self.cands.remove(0).into_seq(), self.layer)); self.reset(); } else if let Some(i) = self.cands.iter().position(|c| c.on.len() == self.times) {