You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
1.3 KiB

local M = {}
local keymap = vim.api.nvim_set_keymap
local buf_keymap = vim.api.nvim_buf_set_keymap
local function keymappings(client, bufnr)
local opts = { noremap = true, silent = true }
-- Key mappings
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "[e", function () vim.diagnostic.goto_prev({severity = vim.diagnostic.severity.ERROR}) end, opts)
vim.keymap.set("n", "]e", function () vim.diagnostic.goto_next({severity = vim.diagnostic.severity.ERROR}) end, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "K", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>of", vim.diagnostic.open_float, opts)
if client.resolved_capabilities.document_formatting then
vim.keymap.set("n", "<leader>ff", vim.lsp.buf.formatting, opts)
end
vim.keymap.set("n", "<leader>d", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<leader>D", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "<leader>h", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<leader>i", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "<leader>T", vim.lsp.buf.type_definition, opts)
end
function M.setup(client, bufnr)
keymappings(client, bufnr)
end
return M