Update keybinds

This commit is contained in:
Kristofers Solo 2023-02-27 13:34:09 +02:00
parent d79bde7f26
commit 2214bee3de
2 changed files with 20 additions and 28 deletions

View File

@ -7,7 +7,6 @@ end
M.capabilities = vim.lsp.protocol.make_client_capabilities() M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem.snippetSupport = true 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.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
M.setup = function() M.setup = function()
@ -55,32 +54,16 @@ end
local function lsp_keymaps(bufnr) local function lsp_keymaps(bufnr)
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
local keymap = vim.api.nvim_buf_set_keymap local keymap = vim.api.nvim_buf_set_keymap
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<cr>", opts)
keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<cr>", opts)
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", opts)
keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<cr>", opts)
keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<cr>", opts)
keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts) keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<cr>", opts)
vim.cmd([[command! Format execute "lua vim.lsp.buf.format()"]]) vim.cmd([[command! Format execute "lua vim.lsp.buf.format()"]])
keymap(bufnr, "n", "<leader>li", "<cmd>LspInfo<cr>", opts)
keymap(bufnr, "n", "<leader>lI", "<cmd>LspInstallInfo<cr>", opts)
keymap(bufnr, "n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
keymap(bufnr, "n", "<leader>lj", "<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>", opts)
keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts)
keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
keymap(bufnr, "n", "<leader>lq", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
end end
M.on_attach = function(client, bufnr) 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) lsp_keymaps(bufnr)
local status_ok, illuminate = pcall(require, "illuminate") local status_ok, illuminate = pcall(require, "illuminate")
if not status_ok then if not status_ok then
@ -106,17 +89,17 @@ M.on_attach = function(client, bufnr)
"alpha", "alpha",
"NvimTree", "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 = {}, filetypes_allowlist = {},
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist -- modes_denylist: modes to not illuminate, this overrides modes_allowlist
modes_denylist = {}, 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 = {}, modes_allowlist = {},
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
-- Only applies to the 'regex' provider -- Only applies to the 'regex' provider
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
providers_regex_syntax_denylist = {}, 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 -- Only applies to the 'regex' provider
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
providers_regex_syntax_allowlist = {}, providers_regex_syntax_allowlist = {},

View File

@ -169,7 +169,6 @@ local mappings = {
}, },
f = { "<cmd>lua vim.lsp.buf.format({ async = true })<cr>", "Format" }, f = { "<cmd>lua vim.lsp.buf.format({ async = true })<cr>", "Format" },
i = { "<cmd>LspInfo<cr>", "Info" }, i = { "<cmd>LspInfo<cr>", "Info" },
I = { "<cmd>LspInstallInfo<cr>", "Installer Info" },
j = { j = {
"<cmd>lua vim.diagnostic.goto_next()<cr>", "<cmd>lua vim.diagnostic.goto_next()<cr>",
"Next Diagnostic", "Next Diagnostic",
@ -187,6 +186,16 @@ local mappings = {
"Workspace Symbols", "Workspace Symbols",
}, },
e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" }, e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
R = {
name = "Rust",
e = { "<cmd>RustExpandMacro<cr>", "Expand macro" },
c = { "<cmd>RustOpenCargo<cr>", "Open cargo.toml" },
p = { "<cmd>RustParentModule<cr>", "Parent module" },
h = { "<cmd>RustHoverActions<cr>", "Hover actions" },
g = { "<cmd>RustViewCrateGraph<cr>", "View crate graph" },
d = { "<cmd>RustOpenExternalDocs<cr>", "Open external docs" },
},
}, },
s = { s = {
name = "Search", name = "Search",
@ -221,7 +230,7 @@ local mappings = {
name = "Vimwiki", name = "Vimwiki",
w = { "<Plug>VimwikiIndex", "Open index file" }, w = { "<Plug>VimwikiIndex", "Open index file" },
t = { "<Plug>VimwikiTabIndex", "Open index file in new tab" }, t = { "<Plug>VimwikiTabIndex", "Open index file in new tab" },
s = { "<Plug>VimwikiUISelect", "Diplay list of wikis" }, s = { "<Plug>VimwikiUISelect", "Display list of wikis" },
i = { "<Plug>VimwikiDiaryIndex", "Open diary index" }, i = { "<Plug>VimwikiDiaryIndex", "Open diary index" },
h = { "<Plug>Vimwiki2HTML", "Convert file to HTML" }, h = { "<Plug>Vimwiki2HTML", "Convert file to HTML" },
H = { "<Plug>Vimwiki2HTMLBrowse", "Convert file to HTML and open in browser" }, H = { "<Plug>Vimwiki2HTMLBrowse", "Convert file to HTML and open in browser" },