feat deps-check: load only when used

This commit is contained in:
Ian
2026-07-11 08:17:52 +02:00
parent 2b60372114
commit 48223a6f54
2 changed files with 26 additions and 14 deletions
+6 -2
View File
@@ -25,7 +25,12 @@ function M.checkCommand(cmd, desc)
end
function M.run()
print("Check installed system commands:")
if cmdsList == nil or next(cmdsList) == nil then
vim.api.nvim_echo({{"Dependencies list passed is null or empty, nothing to check", "DiagnosticWarn"}}, true, {})
return
end
print("Check installed system commands:")
for i, cmd in ipairs(cmdsList) do
M.checkCommand(cmd.cmd, cmd.desc)
end
@@ -34,7 +39,6 @@ end
function M.setup(cmds)
IS_UNIX = package.config:sub(1, 1) ~= "\\"
cmdsList = cmds
vim.api.nvim_create_user_command("DependenciesCheck", M.run, {})
end
return M
+20 -12
View File
@@ -1,15 +1,23 @@
require("check_dependencies").setup({
{ cmd = "git", desc = "git" },
function run()
local dep = require("check_dependencies")
-- fzf dependencies
{ cmd = "fzf", desc = "fuzzy finder" },
{ cmd = "fd", desc = "better find" },
{ cmd = "bat", desc = "cat clone" },
{ cmd = "rg", desc = "rip grep" },
dep.setup({
-- { cmd = "git", desc = "git" },
--
-- -- fzf dependencies
-- { cmd = "fzf", desc = "fuzzy finder" },
-- { cmd = "fd", desc = "better find" },
-- { cmd = "bat", desc = "cat clone" },
-- { cmd = "rg", desc = "rip grep" },
--
-- -- Conform => formatters
-- { cmd = "stylua", desc = "lua formatter" },
--
-- -- Test not exists
-- { cmd = "fff", desc = "test not exists command" },
})
-- Conform => formatters
{ cmd = "stylua", desc = "lua formatter"},
dep.run()
end
-- Test not exists
{ cmd = "fff", desc = "test not exists command"},
})
vim.api.nvim_create_user_command("DependenciesCheck", run, {})