From 13d3559a6346f18f2d5f504ef68aa37cb6534499 Mon Sep 17 00:00:00 2001 From: Anthony Rose Date: Wed, 4 Dec 2024 13:05:49 +0000 Subject: [PATCH] Add useful shortcuts --- init.lua | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index a660a4e..bb96668 100644 --- a/init.lua +++ b/init.lua @@ -13,4 +13,25 @@ end require'lspconfig'.gopls.setup{} -vim.keymap.set("n", "gd", vim.lsp.buf.definition, { silent = true }) +-- None of this should be needed from 0.11.0 (except maybe gd). +do + vim.keymap.set('n', 'gd', function() + vim.lsp.buf.definition() + end, { desc = 'vim.lsp.buf.definition()' }) + + vim.keymap.set('n', 'grn', function() + vim.lsp.buf.rename() + end, { desc = 'vim.lsp.buf.rename()' }) + + vim.keymap.set({ 'n', 'x' }, 'gra', function() + vim.lsp.buf.code_action() + end, { desc = 'vim.lsp.buf.code_action()' }) + + vim.keymap.set('n', 'grr', function() + vim.lsp.buf.references() + end, { desc = 'vim.lsp.buf.references()' }) + + vim.keymap.set('i', '', function() + vim.lsp.buf.signature_help() + end, { desc = 'vim.lsp.buf.signature_help()' }) +end