Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow config fullmatch for 'which' #1290

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yazi-config/preset/yazi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ sort_by = "none"
sort_sensitive = false
sort_reverse = false
sort_translit = false
emit_unique = true

[log]
enabled = false
2 changes: 2 additions & 0 deletions yazi-config/src/which/which.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions yazi-core/src/which/which.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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) {
Expand Down