Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion yazi-core/src/tab/commands/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 3 additions & 1 deletion yazi-plugin/src/external/rg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

pub fn rg(opt: RgOpt) -> Result<UnboundedReceiver<File>> {
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)
Expand Down
3 changes: 3 additions & 0 deletions yazi-proxy/src/options/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ impl TryFrom<CmdCow> for SearchOpt {
pub enum SearchOptVia {
// TODO: remove `None` in the future
None,
Rga,
Rg,
Fd,
}
Expand All @@ -44,6 +45,7 @@ impl From<&str> for SearchOptVia {
match value {
"rg" => Self::Rg,
"fd" => Self::Fd,
"rga" => Self::Rga,
_ => Self::None,
}
}
Expand All @@ -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",
})
Expand Down
Loading