From cb3eea6208daa6ea47194ca40321fec46c5f7d07 Mon Sep 17 00:00:00 2001 From: Claus Beerta Date: Sun, 4 May 2025 09:15:02 +0200 Subject: [PATCH] feat: allow setting the walker --- yazi-plugin/preset/plugins/fzf.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/yazi-plugin/preset/plugins/fzf.lua b/yazi-plugin/preset/plugins/fzf.lua index 45fb5720..e8c57b77 100644 --- a/yazi-plugin/preset/plugins/fzf.lua +++ b/yazi-plugin/preset/plugins/fzf.lua @@ -8,13 +8,13 @@ local state = ya.sync(function() return cx.active.current.cwd, selected end) -function M:entry() +function M:entry(job) ya.emit("escape", { visual = true }) local _permit = ya.hide() local cwd, selected = state() - local output, err = M.run_with(cwd, selected) + local output, err = M.run_with(cwd, selected, job) if not output then return ya.notify { title = "Fzf", content = tostring(err), timeout = 5, level = "error" } end @@ -29,9 +29,15 @@ function M:entry() end end -function M.run_with(cwd, selected) +function M.run_with(cwd, selected, job) + local args = {"-m"} + + if job.args.walker then + table.insert(args, "--walker="..job.args.walker) + end + local child, err = Command("fzf") - :arg("-m") + :args(args) :cwd(tostring(cwd)) :stdin(#selected > 0 and Command.PIPED or Command.INHERIT) :stdout(Command.PIPED)