diff --git a/lua/taken/core/remaps.lua b/lua/taken/core/remaps.lua index 195bd6d..b9ae6fc 100644 --- a/lua/taken/core/remaps.lua +++ b/lua/taken/core/remaps.lua @@ -18,7 +18,12 @@ local M = { ["0"] = { "0", desc = "Go to true line beggining" }, ["q"] = { ":noh" }, -- buffer - ["bf"] = { vim.lsp.buf.format, desc = "Format buffer" }, + ["bf"] = { + function() + vim.lsp.buf.format({ async = false }) + end, + desc = "Format buffer", + }, ["bs"] = { ":write ", desc = "Save buffer" }, [""] = { "cnextzz" }, [""] = { "cprevzz" }, @@ -49,14 +54,6 @@ local M = { end, desc = "Theme selector", }, - - ["sr"] = { - [[:%s/\<\>//gI]], - desc = "Replace all instances of the word on cursor", - }, - - -- lazy - ["lu"] = { "Lazy", desc = "Lazy UI" }, }, vn = { ["y"] = { [["+y]], desc = "Yank in to sys clipboard" }, diff --git a/lua/taken/plugins/otherplugins.lua b/lua/taken/plugins/otherplugins.lua index 1ac63c6..d8b9df3 100644 --- a/lua/taken/plugins/otherplugins.lua +++ b/lua/taken/plugins/otherplugins.lua @@ -70,7 +70,7 @@ return { end, ft = "markdown", keys = { - { "bm", "MarkdownPreviewToggle ", desc = "Toggle markdown preview" }, + { "tm", "MarkdownPreviewToggle ", desc = "Toggle markdown preview" }, }, }, { diff --git a/lua/taken/plugins/whichkey.lua b/lua/taken/plugins/whichkey.lua index 4d8faaf..9d74bd4 100644 --- a/lua/taken/plugins/whichkey.lua +++ b/lua/taken/plugins/whichkey.lua @@ -46,9 +46,6 @@ return { p = { name = "project", }, - v = { - name = "lsp", - }, h = { name = "theme", }, diff --git a/lua/taken/utils/on_attach.lua b/lua/taken/utils/on_attach.lua index eca51d7..17f61d9 100644 --- a/lua/taken/utils/on_attach.lua +++ b/lua/taken/utils/on_attach.lua @@ -1,35 +1,41 @@ local on_attach = function(client, bufnr) - local opts = { noremap = true, silent = true, buffer = bufnr } - vim.keymap.set("n", "gd", "Telescope lsp_definitions", opts) - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts) - vim.keymap.set("n", "gi", "Telescope lsp_implementations", opts) - vim.keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) - vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) + local function opts(desc) + if desc then + return { noremap = true, silent = true, buffer = bufnr, desc = desc } + else + return { noremap = true, silent = true, buffer = bufnr } + end + end + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() - end, opts) + end, opts("Show hover information")) + vim.keymap.set("n", "gd", "Telescope lsp_definitions", opts("Find definitions")) + vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Find declaration")) + vim.keymap.set("n", "gi", "Telescope lsp_implementations", opts("Find implementations")) + vim.keymap.set("n", "gt", "Telescope lsp_type_definitions", opts("Find type definitions")) + vim.keymap.set("n", "gR", "Telescope lsp_references", opts("Find references")) vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() - end, opts) + end, opts("Search workspace symbols")) vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() - end, opts) - vim.keymap.set("n", "[d", function() - vim.diagnostic.goto_next() - end, opts) - vim.keymap.set("n", "]d", function() - vim.diagnostic.goto_prev() - end, opts) + end, opts("Open diagnostics")) vim.keymap.set("n", "vca", function() vim.lsp.buf.code_action() - end, opts) - vim.keymap.set("n", "gR", "Telescope lsp_references", opts) + end, opts("Get code actions")) vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() - end, opts) + end, opts("Rename symbol")) + vim.keymap.set("n", "[d", function() + vim.diagnostic.goto_next() + end, opts("Go to next diagnostic")) + vim.keymap.set("n", "]d", function() + vim.diagnostic.goto_prev() + end, opts("Go to previous diagnostic")) vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() - end, opts) + end, opts("Show signature help")) end return on_attach