jump to definition finally honors my tags file properly
This commit is contained in:
@@ -329,11 +329,25 @@ require'lazy'.setup{ --{{{1
|
|||||||
|
|
||||||
require'lspconfig'.gdscript.setup{}
|
require'lspconfig'.gdscript.setup{}
|
||||||
|
|
||||||
local function jump_to_ctag()
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
pcall(vim.cmd --[[@as fun(...): ...]], "tag " .. vim.fn.expand("<cword>"))
|
callback = function(args)
|
||||||
|
vim.bo[args.buf].tagfunc = nil
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Honors tags file
|
||||||
|
local function jump_to_definition()
|
||||||
|
local word = vim.fn.expand("<cword>")
|
||||||
|
local success = pcall(vim.cmd --[[@as function]], "tag " .. word)
|
||||||
|
if success then
|
||||||
|
print("tag found in tags file")
|
||||||
|
else
|
||||||
|
print("using lsp")
|
||||||
|
vim.lsp.buf.definition()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
vim.keymap.set( 'n', '<c-]>', jump_to_ctag, { noremap = true, })
|
|
||||||
vim.keymap.set( 'n', ',fd', vim.lsp.buf.definition, { noremap = true, })
|
vim.keymap.set( 'n', ',fd', jump_to_definition, { noremap = true, silent = true})
|
||||||
|
|
||||||
vim.cmd [[
|
vim.cmd [[
|
||||||
noremap ,rn :lua vim.lsp.buf.rename()<CR>
|
noremap ,rn :lua vim.lsp.buf.rename()<CR>
|
||||||
|
|||||||
Reference in New Issue
Block a user