aboutsummaryrefslogtreecommitdiff
path: root/lua/kickstart/health.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2024-02-26 10:03:53 -0500
committerGitHub <noreply@github.com>2024-02-26 10:03:53 -0500
commit8b5d48a199c02658e399f5b43ff8d06df1ede7fb (patch)
tree53901eb85496a2d0d1873135b8f9030555541811 /lua/kickstart/health.lua
parent7af594fd319fbae6b2aaa06337f3df8acbbb7f18 (diff)
rewrite: slimmer, trimmer and more lazy kickstart.nvim (#635)
We've removed over 1/3 of the code that was in kickstart previously, and more than doubled the amount of comments explaining every line of code (to the best of my ability). kickstart now properly uses many of the lazy.nvim config and loading idioms, which should be really helpful for people moving both to modular configs, as well as extending the kickstart config in one file. Additional features: - Beautiful ascii art - Added some documentation that explains what is an LSP, what is telescope, etc - There is now a `:checkhealth` for kickstart, which checks some basic information and adds useful information for maintainers (for people cloning the repo). - Improved LSP configuration and tool installation, for easier first time startup - Changed init.lua ordering, so that it moves from simple options to complicated config ``` ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- Lua 1 108 404 298 ------------------------------------------------------------------------------- ```
Diffstat (limited to 'lua/kickstart/health.lua')
-rw-r--r--lua/kickstart/health.lua51
1 files changed, 51 insertions, 0 deletions
diff --git a/lua/kickstart/health.lua b/lua/kickstart/health.lua
new file mode 100644
index 0000000..957204e
--- /dev/null
+++ b/lua/kickstart/health.lua
@@ -0,0 +1,51 @@
+--[[
+--
+-- This file is not required for your own configuration,
+-- but helps people determine if their system is setup correctly.
+--
+--]]
+
+local check_version = function()
+ if not vim.version.cmp then
+ vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
+ return
+ end
+
+ if vim.version.cmp(vim.version(), { 0, 9, 4 }) >= 0 then
+ vim.health.ok(string.format("Neovim version is: '%s'", tostring(vim.version())))
+ else
+ vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", tostring(vim.version())))
+ 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))
+ else
+ vim.health.warn(string.format("Could not find executable: '%s'", exe))
+ end
+ end
+
+ return true
+end
+
+return {
+ check = function()
+ vim.health.start 'kickstart.nvim'
+
+ vim.health.info [[NOTE: Not every warning is a 'must-fix' in `:checkhealth`
+
+ 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!]]
+
+ local uv = vim.uv or vim.loop
+ vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
+
+ check_version()
+ check_external_reqs()
+ end,
+}