health.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --[[
  2. --
  3. -- This file is not required for your own configuration,
  4. -- but helps people determine if their system is setup correctly.
  5. --
  6. --]]
  7. local check_version = function()
  8. local verstr = string.format('%s.%s.%s', vim.version().major, vim.version().minor, vim.version().patch)
  9. if not vim.version.cmp then
  10. vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
  11. return
  12. end
  13. if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
  14. vim.health.ok(string.format("Neovim version is: '%s'", verstr))
  15. else
  16. vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
  17. end
  18. end
  19. local check_external_reqs = function()
  20. -- Basic utils: `git`, `make`, `unzip`
  21. for _, exe in ipairs { 'git', 'make', 'unzip', 'rg' } do
  22. local is_executable = vim.fn.executable(exe) == 1
  23. if is_executable then
  24. vim.health.ok(string.format("Found executable: '%s'", exe))
  25. else
  26. vim.health.warn(string.format("Could not find executable: '%s'", exe))
  27. end
  28. end
  29. return true
  30. end
  31. return {
  32. check = function()
  33. vim.health.start 'kickstart.nvim'
  34. vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
  35. Fix only warnings for plugins and languages you intend to use.
  36. Mason will give warnings for languages that are not installed.
  37. You do not need to install, unless you want to use those languages!]]
  38. local uv = vim.uv or vim.loop
  39. vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
  40. check_version()
  41. check_external_reqs()
  42. end,
  43. }