1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 17:28:01 +00:00

[neovim] Update keymaps

This commit is contained in:
Daniel Carrillo 2022-10-08 17:16:05 +02:00
parent 73e4047c86
commit e086949aaf
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
2 changed files with 11 additions and 9 deletions

View File

@ -44,7 +44,10 @@ keymap("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>", opts)
keymap("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>", opts) keymap("n", "<leader>xd", "<cmd>TroubleToggle document_diagnostics<cr>", opts)
keymap("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>", opts) keymap("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>", opts)
keymap("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", opts) keymap("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", opts)
keymap("n", "gR", "<cmd>TroubleToggle lsp_references<cr>", opts) keymap("n", "gd", "<cmd>TroubleToggle lsp_definitions<cr>", opts)
keymap("n", "gt", "<cmd>TroubleToggle lsp_type_definitions<cr>", opts)
keymap("n", "gi", "<cmd>TroubleToggle lsp_implementations<cr>", opts)
keymap("n", "gr", "<cmd>TroubleToggle lsp_references<cr>", opts)
-- Better paste -- Better paste
keymap("v", "p", '"_dP', opts) keymap("v", "p", '"_dP', opts)

View File

@ -54,21 +54,20 @@ 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.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", "D", "<cmd>lua vim.diagnostic.open_float()<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", "<leader>lf", "<cmd>lua vim.lsp.buf.format{ async=true }<cr>", opts) keymap(bufnr, "n", "<leader>lf", "<cmd>lua vim.lsp.buf.format{ async=true }<cr>", opts)
-- 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>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>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>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>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>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
keymap(bufnr, "n", "<leader>lq", "<cmd>lua vim.diagnostic.setloclist()<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", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
-- keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<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)