diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 47df2c5..dfca736 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -1,57 +1,57 @@ local map = vim.keymap.set -local silent = { silent = true } -- Clear search highlighting on Escape -map("n", "", "nohlsearch", silent) +map("n", "", "nohlsearch", { silent = true, desc = "Clear search highlight" }) --- Visual line navigation +-- Visual line navigation (move by display line over wrapped text) for _, mode in ipairs({ "n", "x" }) do - map(mode, "j", "gj", silent) - map(mode, "k", "gk", silent) + map(mode, "j", "gj", { silent = true, desc = "Down (display line)" }) + map(mode, "k", "gk", { silent = true, desc = "Up (display line)" }) end -- Hover: native LSP hover (press K again to focus the window). -- Border comes from the global `winborder` option. map("n", "K", function() vim.lsp.buf.hover({ max_width = 80 }) end, - { desc = "LSP hover" }) + { desc = "LSP: hover docs" }) -- LSP (rename/code-action/references use native gr* defaults on 0.11+) map("n", "gf", function() require("conform").format({ lsp_format = "fallback" }) end, - { desc = "Format buffer" }) -map("n", "gd", vim.lsp.buf.definition) -map("n", "gD", vim.lsp.buf.declaration) + { desc = "LSP: format buffer" }) +map("n", "gd", vim.lsp.buf.definition, { desc = "LSP: go to definition" }) +map("n", "gD", vim.lsp.buf.declaration, { desc = "LSP: go to declaration" }) -- Trouble map("n", "xx", "Trouble diagnostics toggle focus=true", - { desc = "Diagnostics (Trouble)" }) + { desc = "Trouble: workspace diagnostics" }) map("n", "xX", "Trouble diagnostics toggle filter.buf=0 focus=true", - { desc = "Buffer Diagnostics (Trouble)" }) -map("n", "xt", "Trouble todo toggle", { desc = "Todo (Trouble)" }) + { desc = "Trouble: buffer diagnostics" }) +map("n", "xt", "Trouble todo toggle", { desc = "Trouble: todo list" }) -- Pickers / files -map("n", "", "Pick files") -map("n", "", "Pick grep_live") -map("n", "", "Pick buffers") -map("n", "", "Pick help") -map("n", "", "Oil") -map("n", "", "Pick keymaps") +map("n", "", "Pick files", { desc = "Find: files" }) +map("n", "", "Pick grep_live", { desc = "Find: grep project (disk)" }) +map("n", "", "Pick buf_lines scope='all'", { desc = "Find: grep open buffers" }) +map("n", "", "Pick buffers", { desc = "Find: buffers" }) +map("n", "", "Pick help", { desc = "Find: help tags" }) +map("n", "", "Oil", { desc = "File explorer (Oil)" }) +map("n", "", "Pick keymaps", { desc = "Find: keymaps" }) -- DAP -map("n", "duo", function() require("dapui").open() end) -map("n", "duc", function() require("dapui").close() end) -map("n", "dbp", function() require("dap").toggle_breakpoint() end) -map("n", "drc", function() require("dap").run_to_cursor() end) +map("n", "duo", function() require("dapui").open() end, { desc = "Debug: open UI" }) +map("n", "duc", function() require("dapui").close() end, { desc = "Debug: close UI" }) +map("n", "dbp", function() require("dap").toggle_breakpoint() end, { desc = "Debug: toggle breakpoint" }) +map("n", "drc", function() require("dap").run_to_cursor() end, { desc = "Debug: run to cursor" }) -- Spell map("n", "sc", function() vim.wo.spell = not vim.wo.spell vim.notify("Spell: " .. (vim.wo.spell and "ON" or "OFF")) -end, { desc = "Toggle spell" }) +end, { desc = "Spell: toggle" }) map("n", "sl", function() local cur = vim.opt.spelllang:get()[1] or "" local new = cur == "en" and "de" or "en" vim.opt.spelllang = new vim.notify("Spell lang: " .. new) -end, { desc = "Switch spell language" }) +end, { desc = "Spell: switch language (en/de)" }) diff --git a/lua/plugins.lua b/lua/plugins.lua index 02dd47b..32ce096 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -191,9 +191,9 @@ local function silicon_shot(to_clipboard) if to_clipboard then s.clip() else s.file() end end vim.keymap.set("x", "cc", function() silicon_shot(true) end, - { desc = "Silicon copy" }) + { desc = "Silicon: copy code screenshot to clipboard" }) vim.keymap.set("x", "cs", function() silicon_shot(false) end, - { desc = "Silicon save" }) + { desc = "Silicon: save code screenshot to file" }) require("lualine").setup({ options = { theme = "gruvbox_dark" } }) @@ -232,7 +232,8 @@ local textobj = { } for lhs, query in pairs(textobj) do vim.keymap.set({ "x", "o" }, lhs, - function() tso.select_textobject(query, "textobjects") end) + function() tso.select_textobject(query, "textobjects") end, + { desc = "Textobject: " .. query:gsub("@", "") }) end -- Mason: ensure tools