separate jump to tag and jump to definition

This commit is contained in:
Ivar Fatland
2025-04-10 11:16:27 +02:00
parent 4048ac1b0c
commit 4483b7077c
+4 -8
View File
@@ -329,15 +329,11 @@ require'lazy'.setup{ --{{{1
require'lspconfig'.gdscript.setup{}
local function jump_to_definition()
-- try to find definition with ctags first
local tag_jump_success = pcall(vim.cmd --[[@as fun(...): ...]], "tag " .. vim.fn.expand("<cword>"))
-- otherwise, try with lsp
if not tag_jump_success then
vim.lsp.buf.definition()
local function jump_to_ctag()
pcall(vim.cmd --[[@as fun(...): ...]], "tag " .. vim.fn.expand("<cword>"))
end
end
vim.keymap.set( 'n', ',fd', jump_to_definition, { noremap = true, })
vim.keymap.set( 'n', '<c-]>', jump_to_ctag, { noremap = true, })
vim.keymap.set( 'n', ',fd', vim.lsp.buf.definition, { noremap = true, })
vim.cmd [[
noremap ,rn :lua vim.lsp.buf.rename()<CR>