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

@@ -32,7 +32,22 @@ return {
dbml = { "dbml" }, -- DBML formatting
sql = { "sqlfluff" }, -- SQL formatting
},
format_on_save = false, -- Set to true if you want auto-formatting on save
format_on_save = function(bufnr)
-- Disable autoformat for certain filetypes
local ignore_filetypes = { "sql", "markdown" }
if vim.tbl_contains(ignore_filetypes, vim.bo[bufnr].filetype) then
return
end
-- Disable for files in certain paths
local bufname = vim.api.nvim_buf_get_name(bufnr)
if bufname:match("/node_modules/") then
return
end
return {
timeout_ms = 2000,
lsp_fallback = true,
}
end,
})
vim.keymap.set({ "n", "v" }, "<leader>mm", function()
@@ -41,6 +56,16 @@ return {
async = false,
timeout_ms = 2000,
})
end, { desc = "Format file or range (in visual mode)" })
end, { desc = "Format: File or range (in visual mode)" })
-- Toggle auto-format on save
vim.api.nvim_create_user_command("FormatToggle", function()
vim.g.disable_autoformat = not vim.g.disable_autoformat
if vim.g.disable_autoformat then
vim.notify("Auto-format on save disabled", vim.log.levels.INFO)
else
vim.notify("Auto-format on save enabled", vim.log.levels.INFO)
end
end, { desc = "Toggle auto-format on save" })
end,
}

View File

@@ -49,7 +49,7 @@ return {
},
}
-- Custom word/character counter function
-- Custom word counter function
local function word_count()
-- Skip for very large files to avoid performance issues
local line_count = vim.api.nvim_buf_line_count(0)
@@ -58,7 +58,6 @@ return {
end
local words = 0
local chars = 0
-- Get all lines at once for better performance
local all_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
@@ -69,13 +68,11 @@ return {
for _ in line:gmatch("%S+") do
words = words + 1
end
-- Count characters (excluding newline)
chars = chars + #line
end
end
-- Format: show words and characters
return string.format("%d words, %d chars", words, chars)
-- Format: show only word count
return string.format("%d words", words)
end
-- configure lualine with modified theme

View File

@@ -5,9 +5,38 @@ return {
vim.o.timeout = true
vim.o.timeoutlen = 200 -- Reduced from 500 for faster response
end,
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
},
config = function()
local wk = require("which-key")
wk.setup({
plugins = {
marks = true,
registers = true,
spelling = { enabled = true, suggestions = 20 },
},
win = {
border = "rounded",
padding = { 2, 2, 2, 2 },
},
})
-- Register group names for better organization
wk.add({
{ "<leader>b", group = "Buffer" },
{ "<leader>c", group = "Code/Copilot" },
{ "<leader>d", group = "Debug/DAP" },
{ "<leader>e", group = "Explorer" },
{ "<leader>f", group = "Find/Files" },
{ "<leader>g", group = "Git" },
{ "<leader>l", group = "LSP/LeetCode" },
{ "<leader>m", group = "Format" },
{ "<leader>n", group = "Notifications" },
{ "<leader>p", group = "Project" },
{ "<leader>q", group = "Quickfix" },
{ "<leader>s", group = "Session/Split/Substitute" },
{ "<leader>t", group = "Tab/Terminal/Text" },
{ "<leader>x", group = "Trouble/Diagnostics" },
{ "<leader>z", group = "Copilot Chat" },
})
end,
}