From 4aba933e69ad447006b9782b74e9066f385341bf Mon Sep 17 00:00:00 2001 From: Andrzej Stepien Date: Sun, 17 Mar 2024 17:25:46 +0100 Subject: [PATCH] uncomment lsp keymaps --- lua/keymaps.lua | 91 ++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 46 deletions(-) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index 4c75eb9..393bddd 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -16,49 +16,48 @@ map("n", "n", ":Neotree toggle") --open Nerdtree map("n", "z", ":ZenMode") --open ZenMode (distraction-free) map("n", "d", ":ToggleDiag") -- toggle all diagnostics --- vim.api.nvim_create_autocmd('LspAttach', { --- desc = 'LSP actions', --- callback = function() --- local bufmap = function(mode, lhs, rhs) --- local opts = {buffer = true} --- vim.keymap.set(mode, lhs, rhs, opts) --- end --- --- -- Displays hover information about the symbol under the cursor --- bufmap('n', 'K', 'lua vim.lsp.buf.hover()') --- --- -- Jump to the definition --- bufmap('n', 'gd', 'lua vim.lsp.buf.definition()') --- --- -- Jump to declaration --- bufmap('n', 'gD', 'lua vim.lsp.buf.declaration()') --- --- -- Lists all the implementations for the symbol under the cursor --- bufmap('n', 'gi', 'lua vim.lsp.buf.implementation()') --- --- -- Jumps to the definition of the type symbol --- bufmap('n', 'go', 'lua vim.lsp.buf.type_definition()') --- --- -- Lists all the references --- bufmap('n', 'gr', 'lua vim.lsp.buf.references()') --- --- -- Displays a function's signature information --- bufmap('n', 'gs', 'lua vim.lsp.buf.signature_help()') --- --- -- Renames all references to the symbol under the cursor --- bufmap('n', '', 'lua vim.lsp.buf.rename()') --- --- -- Selects a code action available at the current cursor position --- bufmap('n', '', 'lua vim.lsp.buf.code_action()') --- --- -- Show diagnostics in a floating window --- bufmap('n', 'gl', 'lua vim.diagnostic.open_float()') --- --- -- Move to the previous diagnostic --- bufmap('n', '[d', 'lua vim.diagnostic.goto_prev()') --- --- -- Move to the next diagnostic --- bufmap('n', ']d', 'lua vim.diagnostic.goto_next()') --- end --- }) --- +vim.api.nvim_create_autocmd("LspAttach", { + desc = "LSP actions", + callback = function() + local bufmap = function(mode, lhs, rhs) + local opts = { buffer = true } + vim.keymap.set(mode, lhs, rhs, opts) + end + + -- Displays hover information about the symbol under the cursor + bufmap("n", "K", "lua vim.lsp.buf.hover()") + + -- Jump to the definition + bufmap("n", "gd", "lua vim.lsp.buf.definition()") + + -- Jump to declaration + bufmap("n", "gD", "lua vim.lsp.buf.declaration()") + + -- Lists all the implementations for the symbol under the cursor + bufmap("n", "gi", "lua vim.lsp.buf.implementation()") + + -- Jumps to the definition of the type symbol + bufmap("n", "go", "lua vim.lsp.buf.type_definition()") + + -- Lists all the references + bufmap("n", "gr", "lua vim.lsp.buf.references()") + + -- Displays a function's signature information + bufmap("n", "gs", "lua vim.lsp.buf.signature_help()") + + -- Renames all references to the symbol under the cursor + bufmap("n", "", "lua vim.lsp.buf.rename()") + + -- Selects a code action available at the current cursor position + bufmap("n", "", "lua vim.lsp.buf.code_action()") + + -- Show diagnostics in a floating window + bufmap("n", "gl", "lua vim.diagnostic.open_float()") + + -- Move to the previous diagnostic + bufmap("n", "[d", "lua vim.diagnostic.goto_prev()") + + -- Move to the next diagnostic + bufmap("n", "]d", "lua vim.diagnostic.goto_next()") + end, +})