From 2214bee3de876b5567912a550cc8313a7b4d8835 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Mon, 27 Feb 2023 13:34:09 +0200 Subject: [PATCH] Update keybinds --- lua/user/mason/handlers.lua | 35 +++++++++-------------------------- lua/user/whichkey.lua | 13 +++++++++++-- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/lua/user/mason/handlers.lua b/lua/user/mason/handlers.lua index 60fe28e..ff446a1 100644 --- a/lua/user/mason/handlers.lua +++ b/lua/user/mason/handlers.lua @@ -7,7 +7,6 @@ end M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities.textDocument.completion.completionItem.snippetSupport = true --- M.capabilities = cmp_nvim_lsp.update_capabilities(M.capabilities) M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities) M.setup = function() @@ -55,32 +54,16 @@ end local function lsp_keymaps(bufnr) local opts = { noremap = true, silent = true } local keymap = vim.api.nvim_buf_set_keymap - keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) - keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) - keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) - keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) + keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) + keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) + keymap(bufnr, "n", "K", "lua vim.lsp.buf.hover()", opts) + keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) + keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) + keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) vim.cmd([[command! Format execute "lua vim.lsp.buf.format()"]]) - keymap(bufnr, "n", "li", "LspInfo", opts) - keymap(bufnr, "n", "lI", "LspInstallInfo", opts) - keymap(bufnr, "n", "la", "lua vim.lsp.buf.code_action()", opts) - keymap(bufnr, "n", "lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) - keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) - keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) - keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) - keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) end M.on_attach = function(client, bufnr) - -- if client.name == "tsserver" then - -- client.resolved_capabilities.document_formatting = false - -- end - -- - -- if client.name == "sumneko_lua" then - -- client.resolved_capabilities.document_formatting = false - -- end - lsp_keymaps(bufnr) local status_ok, illuminate = pcall(require, "illuminate") if not status_ok then @@ -106,17 +89,17 @@ M.on_attach = function(client, bufnr) "alpha", "NvimTree", }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist filetypes_allowlist = {}, -- modes_denylist: modes to not illuminate, this overrides modes_allowlist modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist modes_allowlist = {}, -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist -- Only applies to the 'regex' provider -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist -- Only applies to the 'regex' provider -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') providers_regex_syntax_allowlist = {}, diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua index 2f43c4b..e4402b7 100644 --- a/lua/user/whichkey.lua +++ b/lua/user/whichkey.lua @@ -169,7 +169,6 @@ local mappings = { }, f = { "lua vim.lsp.buf.format({ async = true })", "Format" }, i = { "LspInfo", "Info" }, - I = { "LspInstallInfo", "Installer Info" }, j = { "lua vim.diagnostic.goto_next()", "Next Diagnostic", @@ -187,6 +186,16 @@ local mappings = { "Workspace Symbols", }, e = { "Telescope quickfix", "Telescope Quickfix" }, + + R = { + name = "Rust", + e = { "RustExpandMacro", "Expand macro" }, + c = { "RustOpenCargo", "Open cargo.toml" }, + p = { "RustParentModule", "Parent module" }, + h = { "RustHoverActions", "Hover actions" }, + g = { "RustViewCrateGraph", "View crate graph" }, + d = { "RustOpenExternalDocs", "Open external docs" }, + }, }, s = { name = "Search", @@ -221,7 +230,7 @@ local mappings = { name = "Vimwiki", w = { "VimwikiIndex", "Open index file" }, t = { "VimwikiTabIndex", "Open index file in new tab" }, - s = { "VimwikiUISelect", "Diplay list of wikis" }, + s = { "VimwikiUISelect", "Display list of wikis" }, i = { "VimwikiDiaryIndex", "Open diary index" }, h = { "Vimwiki2HTML", "Convert file to HTML" }, H = { "Vimwiki2HTMLBrowse", "Convert file to HTML and open in browser" },