2023-01-24 08:17:10 +01:00
|
|
|
local M = {}
|
|
|
|
|
2023-04-23 11:04:05 +02:00
|
|
|
local start = vim.health.start or vim.health.report_start
|
|
|
|
local ok = vim.health.ok or vim.health.report_ok
|
|
|
|
local warn = vim.health.warn or vim.health.report_warn
|
|
|
|
local error = vim.health.error or vim.health.report_error
|
|
|
|
|
2023-01-24 08:17:10 +01:00
|
|
|
function M.check()
|
2023-04-23 11:04:05 +02:00
|
|
|
start("LazyVim")
|
2023-01-24 08:17:10 +01:00
|
|
|
|
2023-10-01 14:17:54 +02:00
|
|
|
if vim.fn.has("nvim-0.9.0") == 1 then
|
|
|
|
ok("Using Neovim >= 0.9.0")
|
2024-05-16 16:49:35 +02:00
|
|
|
if vim.fn.has("nvim-0.10.0") == 0 then
|
|
|
|
warn("Use Neovim >= 0.10.0 for the best experience")
|
|
|
|
end
|
2023-01-24 08:17:10 +01:00
|
|
|
else
|
2023-10-01 14:17:54 +02:00
|
|
|
error("Neovim >= 0.9.0 is required")
|
2023-01-24 08:17:10 +01:00
|
|
|
end
|
|
|
|
|
2024-12-14 07:44:00 +01:00
|
|
|
for _, cmd in ipairs({ "git", "rg", { "fd", "fdfind" }, "lazygit", "fzf" }) do
|
2023-02-15 14:03:41 +01:00
|
|
|
local name = type(cmd) == "string" and cmd or vim.inspect(cmd)
|
|
|
|
local commands = type(cmd) == "string" and { cmd } or cmd
|
|
|
|
---@cast commands string[]
|
|
|
|
local found = false
|
|
|
|
|
|
|
|
for _, c in ipairs(commands) do
|
|
|
|
if vim.fn.executable(c) == 1 then
|
|
|
|
name = c
|
|
|
|
found = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if found then
|
2023-04-23 11:04:05 +02:00
|
|
|
ok(("`%s` is installed"):format(name))
|
2023-01-24 08:17:10 +01:00
|
|
|
else
|
2023-04-23 11:04:05 +02:00
|
|
|
warn(("`%s` is not installed"):format(name))
|
2023-01-24 08:17:10 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|