diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 6bc4f60..ce6f4bc 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -1,17 +1,19 @@ local on_attach = function(_, bufnr) + local desc = function (desc) + return { noremap = true, silent = true, buffer = bufnr, desc = desc } + end local ts = require("telescope.builtin") - local opts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) - vim.keymap.set("n", "ca", vim.lsp.buf.code_action, opts) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) - vim.keymap.set("n", "ge", vim.diagnostic.open_float, opts) - vim.keymap.set("n", "gf", function() vim.lsp.buf.format { async = true } end, opts) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) - vim.keymap.set("n", "gk", vim.lsp.buf.hover, opts) - vim.keymap.set("n", "gK", vim.lsp.buf.signature_help, opts) - vim.keymap.set("n", "gn", function() vim.diagnostic.jump({ count = 1, float = true }) end, opts) - vim.keymap.set("n", "gN", function() vim.diagnostic.jump({ count = -1, float = true }) end, opts) - vim.keymap.set("n", "gr", ts.lsp_references, opts) + vim.keymap.set("n", "rn", vim.lsp.buf.rename, desc("Rename identifier")) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, desc("Code actions")) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, desc("Jump to definition")) + vim.keymap.set("n", "ge", vim.diagnostic.open_float, desc("Open diagnostics, show errors")) + vim.keymap.set("n", "gf", function() vim.lsp.buf.format { async = true } end, desc("Format code")) + vim.keymap.set("n", "gi", vim.lsp.buf.implementation, desc("Jump to implementation")) + vim.keymap.set("n", "gk", vim.lsp.buf.hover, desc("Show quick-docs")) + vim.keymap.set("n", "gK", vim.lsp.buf.signature_help, desc("Show signature")) + vim.keymap.set("n", "gn", function() vim.diagnostic.jump({ count = 1, float = true }) end, desc("Jump to next occurence")) + vim.keymap.set("n", "gN", function() vim.diagnostic.jump({ count = -1, float = true }) end, desc("Jump to previous occurence")) + vim.keymap.set("n", "gr", ts.lsp_references, desc("Search references")) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") end diff --git a/.config/nvim/lua/plugins/vimwiki.lua b/.config/nvim/lua/plugins/vimwiki.lua index 65b58e0..6ad7cba 100644 --- a/.config/nvim/lua/plugins/vimwiki.lua +++ b/.config/nvim/lua/plugins/vimwiki.lua @@ -34,7 +34,7 @@ vim.api.nvim_create_autocmd("FileType", { vim.opt_local.wrap = true vim.opt_local.number = false vim.opt_local.relativenumber = false - vim.keymap.set("n", "ws", "Gw | G commit-and-push") + vim.keymap.set("n", "ws", "Gw | G commit-and-push", { desc = "Save, commit & push" }) end, })