Skip to content

Commit 06e8787

Browse files
folkeibhagwan
authored andcommitted
fix: required diff windows/linux/macos
1 parent c4935fd commit 06e8787

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

lua/fzf/health.lua

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ local warn = vim.health.warn or vim.health.report_warn
66
local error = vim.health.error or vim.health.report_error
77

88
function M.check()
9+
local is_win = jit.os:find("Windows")
910
local utils = require("fzf-lua.utils")
10-
local config = require("fzf-lua.config")
1111

1212
local function have(tool)
1313
if vim.fn.executable(tool) == 0 then
@@ -21,9 +21,31 @@ function M.check()
2121
end
2222

2323
start("fzf-lua [required]")
24-
if not have("fzf") and not have("sk") then
25-
error("`fzf` or `skim` is required")
24+
local required = {
25+
{ "fzf", "sk" },
26+
is_win and { "rg" } or { "rg", "grep" },
27+
is_win and { "fd", "find", "dir" } or { "fd", "find" },
28+
}
29+
30+
for _, reqs in ipairs(required) do
31+
local found = false
32+
for _, tool in ipairs(reqs) do
33+
if have(tool) then
34+
found = true
35+
break
36+
end
37+
end
38+
if not found then
39+
local str = table.concat(
40+
vim.tbl_map(function(tool)
41+
return "`" .. tool .. "`"
42+
end, reqs),
43+
", "
44+
)
45+
error("One of " .. str .. " is required")
46+
end
2647
end
48+
2749
if vim.fn.executable("fzf") == 1 then
2850
local version = utils.fzf_version()
2951
if version < 0.53 then

0 commit comments

Comments
 (0)