Refactor config: fix conflicts, add features, update docs

- Fix keymap conflicts: session (<leader>sS/sR), substitute (<leader>sl)
- Remove duplicate keymaps (window, resize) and options (synmaxcol, foldmethod)
- Add which-key group names for better keymap organization
- Add auto-format on save with smart filtering (conform.nvim)
- Add diagnostic float on hover (CursorHold)
- Add safe buffer close with unsaved changes confirmation
- Add quickfix/location list navigation keymaps
- Add startup config validation (nvim version, executables)
- Enable plugin update notifications in lazy.nvim
- Clean up: remove temporary files (kkk, cleanup script)
- Clean up: remove commented code and fix double function loading
- Update README.md with comprehensive documentation
- Add CHANGELOG.md tracking all changes
This commit is contained in:
Carlos Gutierrez
2026-01-10 22:13:59 -05:00
parent 0066ac1441
commit cd817820ca
15 changed files with 490 additions and 1093 deletions

View File

@@ -34,31 +34,80 @@ local function load_functions()
end
-- 4. Fix: Force filetype detection on BufRead (fix for nvim-tree/plain text issue)
-- Only run if filetype is not already detected to avoid redundant calls
vim.api.nvim_create_autocmd("BufRead", {
pattern = "*",
callback = function()
vim.cmd("silent filetype detect")
if vim.bo.filetype == "" then
vim.cmd("silent filetype detect")
end
end,
})
-- 5. Load functions immediately
load_functions()
-- 6. Fallback: also try to load on VimEnter if LazyDone doesn't fire
-- 5. Load functions on VimEnter to ensure plugins are loaded first
-- Using a flag to prevent double-loading
local functions_loaded = false
vim.api.nvim_create_autocmd("VimEnter", {
callback = function()
-- Wait a bit for plugins to load
vim.defer_fn(function()
load_functions()
end, 200)
if not functions_loaded then
vim.defer_fn(function()
load_functions()
functions_loaded = true
end, 200)
end
end,
once = true,
})
--[[ vim.api.nvim_create_autocmd("BufReadPost", {
once = true,
-- 6. Diagnostic float on hover (show diagnostics when cursor holds)
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
require("cargdev.core.project_config").bootstrap_config()
end
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always",
prefix = " ",
scope = "cursor",
}
vim.diagnostic.open_float(nil, opts)
end,
})
]]
-- 7. Configuration validation on startup
local function validate_config()
local warnings = {}
-- Check Neovim version (require 0.9+)
if vim.fn.has("nvim-0.9") == 0 then
table.insert(warnings, "Neovim 0.9+ is recommended for this configuration")
end
-- Check for required executables
local required_executables = { "git", "rg", "node" }
for _, exe in ipairs(required_executables) do
if vim.fn.executable(exe) == 0 then
table.insert(warnings, string.format("'%s' not found in PATH", exe))
end
end
-- Display warnings if any
if #warnings > 0 then
vim.defer_fn(function()
for _, warning in ipairs(warnings) do
vim.notify("Config Warning: " .. warning, vim.log.levels.WARN)
end
end, 1000)
end
end
-- Run validation on startup
vim.api.nvim_create_autocmd("VimEnter", {
callback = validate_config,
once = true,
})
-- 8. Custom health check command
vim.api.nvim_create_user_command("CheckConfig", function()
vim.cmd("checkhealth")
end, { desc = "Run Neovim health check" })