From 354ed2329175d666df13a29206a21d79a71315f5 Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Wed, 17 Apr 2024 13:02:12 +0900 Subject: [PATCH] Add shortcuts to LSP get declaration/definition nvim-lspconfig already has shortcuts to declaration/definition with "gd" and "gD", but in testing, they did not behave the same as the shortcuts defined in this commit for some reason. d and D are the shortcuts defined for definition/declaration ( is by defalt back-slash "\"). Show floating diagnostic changed to F. --- pack/packages/start/loadlsp/autoload/loadlsp.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pack/packages/start/loadlsp/autoload/loadlsp.vim b/pack/packages/start/loadlsp/autoload/loadlsp.vim index 0a91354..2b8fbba 100644 --- a/pack/packages/start/loadlsp/autoload/loadlsp.vim +++ b/pack/packages/start/loadlsp/autoload/loadlsp.vim @@ -134,12 +134,16 @@ lspconfig.jedi_language_server.setup{ -- apply available fix vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.code_action()", {noremap = true}) +-- get lsp declaration +vim.api.nvim_set_keymap("n", "D", "lua vim.lsp.buf.declaration()", {noremap = true}) +-- get lsp definition +vim.api.nvim_set_keymap("n", "d", "lua vim.lsp.buf.definition()", {noremap = true}) -- goto next warning/error --vim.api.nvim_set_keymap("n", "", "lua vim.lsp.diagnostic.goto_next()", {noremap = true}) vim.api.nvim_set_keymap("n", "", "lua vim.diagnostic.goto_next()", {noremap = true}) vim.api.nvim_set_keymap("n", "", "lua vim.diagnostic.goto_prev()", {noremap = true}) -- Get diagnostic on currently selected -vim.api.nvim_set_keymap("n", "d", "lua vim.diagnostic.open_float()", {noremap = true}) +vim.api.nvim_set_keymap("n", "F", "lua vim.diagnostic.open_float()", {noremap = true}) EOF