diff --git a/yazi-core/src/tab/commands/search.rs b/yazi-core/src/tab/commands/search.rs index 69213313..e20259f5 100644 --- a/yazi-core/src/tab/commands/search.rs +++ b/yazi-core/src/tab/commands/search.rs @@ -48,8 +48,9 @@ impl Tab { let hidden = self.pref.show_hidden; self.search = Some(tokio::spawn(async move { - let rx = if opt.via == SearchOptVia::Rg { + let rx = if opt.via == SearchOptVia::Rg || opt.via == SearchOptVia::Rga { external::rg(external::RgOpt { + rga: SearchOptVia::Rga == opt.via, cwd: cwd.clone(), hidden, subject: opt.subject.into_owned(), diff --git a/yazi-plugin/src/external/rg.rs b/yazi-plugin/src/external/rg.rs index c4d5674e..ff3e6f1a 100644 --- a/yazi-plugin/src/external/rg.rs +++ b/yazi-plugin/src/external/rg.rs @@ -7,13 +7,15 @@ use yazi_shared::url::Url; pub struct RgOpt { pub cwd: Url, + pub rga: bool, pub hidden: bool, pub subject: String, pub args: Vec, } pub fn rg(opt: RgOpt) -> Result> { - let mut child = Command::new("rg") + let commandname = if opt.rga { "rga" } else { "rg" }; + let mut child = Command::new(commandname) .args(["--color=never", "--files-with-matches", "--smart-case"]) .arg(if opt.hidden { "--hidden" } else { "--no-hidden" }) .args(opt.args) diff --git a/yazi-proxy/src/options/search.rs b/yazi-proxy/src/options/search.rs index 03e82c42..e87c5e97 100644 --- a/yazi-proxy/src/options/search.rs +++ b/yazi-proxy/src/options/search.rs @@ -35,6 +35,7 @@ impl TryFrom for SearchOpt { pub enum SearchOptVia { // TODO: remove `None` in the future None, + Rga, Rg, Fd, } @@ -44,6 +45,7 @@ impl From<&str> for SearchOptVia { match value { "rg" => Self::Rg, "fd" => Self::Fd, + "rga" => Self::Rga, _ => Self::None, } } @@ -53,6 +55,7 @@ impl Display for SearchOptVia { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(match self { Self::Rg => "rg", + Self::Rga => "rga", Self::Fd => "fd", Self::None => "none", })