diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-06-23 13:08:59 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-06-23 13:08:59 +0900 |
| commit | 70287aefe98985ea8e8398ecb1495971e89ee49c (patch) | |
| tree | 925ed12b1700c61e50284bb17b55a2f75fdd6709 /ar/.config/TheSiahxyz/lua | |
| parent | a53d8cb3ae1b664ff41ce393569f5666f9549a2c (diff) | |
modified TheSiahxyz/health.lua, deleted TheSiahxyz/shortcuts.lua
Diffstat (limited to 'ar/.config/TheSiahxyz/lua')
| -rw-r--r-- | ar/.config/TheSiahxyz/lua/TheSiahxyz/health.lua | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/ar/.config/TheSiahxyz/lua/TheSiahxyz/health.lua b/ar/.config/TheSiahxyz/lua/TheSiahxyz/health.lua index dba5f3a..b2cbba2 100644 --- a/ar/.config/TheSiahxyz/lua/TheSiahxyz/health.lua +++ b/ar/.config/TheSiahxyz/lua/TheSiahxyz/health.lua @@ -1,38 +1,53 @@ +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 + local check_version = function() - local verstr = string.format("%s.%s.%s", vim.version().major, vim.version().minor, vim.version().patch) + local version = vim.version() + local verstr = ("%d.%d.%d"):format(version.major, version.minor, version.patch) + if not vim.version.cmp then - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) return end - if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then - vim.health.ok(string.format("Neovim version is: '%s'", verstr)) + if vim.version.cmp(vim.version(), { 0, 10, 0 }) >= 0 then + ok(string.format("Neovim version is: '%s'", verstr)) else - vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) + error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr)) end end local check_external_reqs = function() - -- Basic utils: `git`, `make`, `unzip` - for _, exe in ipairs({ "git", "make", "unzip", "rg" }) do - local is_executable = vim.fn.executable(exe) == 1 - if is_executable then - vim.health.ok(string.format("Found executable: '%s'", exe)) + for _, cmd in ipairs({ "git", "make", "unzip", "rg", { "fd", "fdfind" }, "lazygit", "fzf", "curl" }) do + 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 + ok(("`%s` is installed"):format(name)) else - vim.health.warn(string.format("Could not find executable: '%s'", exe)) + warn(("`%s` is not installed"):format(name)) end end - - return true end return { check = function() - vim.health.start("TheSiahxyz") + start("TheSiahxyz") vim.health.info([[NOTE: Not every warning is a 'must-fix' in `:checkhealth` - Fix only warnings for plugins and languages you intend to use. + Fix only warnings for plugins and languages you intend to use. Mason will give warnings for languages that are not installed. You do not need to install, unless you want to use those languages!]]) |
