nvim-config/lua/core/health.lua
dlond f81cab2da3 refactor: Complete modular migration from kickstart.nvim
Major architectural overhaul to transform the flat kickstart.nvim structure
  into a maintainable, modular configuration while preserving upstream sync capability.

  ## Structure Changes
  - Migrated from flat `lua/custom/` to organized `lua/core/` and `lua/plugins/`
  - Separated plugin specs from configs: `lua/plugins/spec/` and `lua/plugins/config/`
  - Complex configs (LSP, Debug) now use directory structure with sub-modules:
    - `lsp/init.lua`, `lsp/servers.lua`, `lsp/keymaps.lua`
    - `debug/init.lua`, `debug/adapters.lua`, `debug/keymaps.lua`

  ## Core Improvements
  - Created dedicated core modules: options, keymaps, autocmds, bootstrap, health
  - Added comprehensive health check (`lua/core/health.lua`) for diagnostics
  - Simplified init.lua to just orchestrate module loading
  - Better separation of concerns throughout

  ## Plugin Updates
  - Fixed Blink.cmp configuration (removed invalid fuzzy options)
  - Integrated Copilot with Blink.cmp for unified completion experience
  - Added autopairs and indent-line from kickstart examples
  - Optimized for Nix development environments (removed venv assumptions)

  ## Documentation
  - Updated README with modular structure and kickstart sync instructions
  - Created comprehensive KEYBIND_ANALYSIS.md with all mappings
  - Added modular.txt help documentation
  - Created TODO_TEST.md checklist for testing

  ## Benefits
  - Easier to maintain and extend
  - Clean separation allows upstream kickstart merges without conflicts
  - Scalable architecture for adding new languages/tools
  - Better code organization and discoverability

  All kickstart functionality preserved while gaining modularity and maintainability.
2025-09-02 13:23:53 +12:00

98 lines
No EOL
3.2 KiB
Lua

-- Health check for the modular Neovim configuration
local M = {}
local check_version = function()
local verstr = tostring(vim.version())
if not vim.version.ge then
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
return
end
if vim.version.ge(vim.version(), '0.10-dev') then
vim.health.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))
end
end
local check_external_reqs = function()
-- Basic utils
for _, exe in ipairs { 'git', 'make', 'unzip' } 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
-- Search tools
for _, exe in ipairs { 'rg', 'fd' } do
local is_executable = vim.fn.executable(exe) == 1
if is_executable then
vim.health.ok(string.format("Found search tool: '%s'", exe))
else
vim.health.warn(string.format("Could not find search tool: '%s' (required for Telescope)", exe))
end
end
end
local check_lsp_servers = function()
-- Check for LSP servers installed via Nix
local servers = {
{ name = 'clangd', desc = 'C/C++ language server' },
{ name = 'pyright', desc = 'Python language server' },
{ name = 'ruff', desc = 'Python linter/formatter' },
{ name = 'nixd', desc = 'Nix language server' },
{ name = 'texlab', desc = 'LaTeX language server' },
{ name = 'cmake-language-server', desc = 'CMake language server' },
}
vim.health.start('LSP Servers (via Nix/Home Manager)')
for _, server in ipairs(servers) do
local is_executable = vim.fn.executable(server.name) == 1
if is_executable then
vim.health.ok(string.format("Found %s: '%s'", server.desc, server.name))
else
vim.health.info(string.format("Not found: '%s' (%s) - install via Nix if needed", server.name, server.desc))
end
end
end
local check_formatters = function()
-- Check for formatters installed via Nix
local formatters = {
{ name = 'stylua', filetype = 'lua' },
{ name = 'clang-format', filetype = 'c/cpp' },
{ name = 'alejandra', filetype = 'nix' },
}
vim.health.start('Formatters (via Nix/Home Manager)')
for _, formatter in ipairs(formatters) do
local is_executable = vim.fn.executable(formatter.name) == 1
if is_executable then
vim.health.ok(string.format("Found formatter for %s: '%s'", formatter.filetype, formatter.name))
else
vim.health.info(string.format("Not found: '%s' (%s) - install via Nix if needed", formatter.name, formatter.filetype))
end
end
end
function M.check()
vim.health.start('Modular Neovim Configuration')
vim.health.info [[NOTE: Not every warning needs to be fixed.
Only install tools for languages you actually use.
All language servers and formatters should be installed via Nix/Home Manager.]]
local uv = vim.uv or vim.loop
vim.health.info('System Information: ' .. vim.inspect(uv.os_uname()))
check_version()
check_external_reqs()
check_lsp_servers()
check_formatters()
end
return M