From 505ad6b4a370d75ab188ac6a7632a222d39cc25a Mon Sep 17 00:00:00 2001 From: hankertrix <91734413+hankertrix@users.noreply.github.com> Date: Mon, 30 Dec 2024 21:40:21 +0800 Subject: [PATCH] refactor: look at the zoxide output instead of spawning fzf --- yazi-plugin/preset/plugins/zoxide.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/yazi-plugin/preset/plugins/zoxide.lua b/yazi-plugin/preset/plugins/zoxide.lua index e06c4d9b..cf62f8ea 100644 --- a/yazi-plugin/preset/plugins/zoxide.lua +++ b/yazi-plugin/preset/plugins/zoxide.lua @@ -89,12 +89,6 @@ local function entry() local _permit = ya.hide() - local fzf, _err = Command("fzf"):arg("--version"):stdout(Command.PIPED):stderr(Command.PIPED):output() - - if not fzf then - return fail(string.format("%s\n%s", "`fzf` is required for the `zoxide` plugin.", "Please install `fzf`.")) - end - local child, err = Command("zoxide") :args({ "query", "-i", "--exclude" }) :arg(st.cwd) @@ -114,6 +108,8 @@ local function entry() local output, error = child:wait_with_output() if not output then return fail("Cannot read `zoxide` output, error: " .. error) + elseif output.stderr:find("could not find") then + return fail(output.stderr) elseif not output.status.success and output.status.code ~= 130 then return fail("`zoxide` exited with error code %s", output.status.code) end