From 846acbc899f79dc683e0907bc237f01afbd6637c Mon Sep 17 00:00:00 2001 From: Ivar Fatland Date: Fri, 11 Apr 2025 10:59:13 +0200 Subject: [PATCH] separate find ctag and find definition into different keys Sometimes the tags file contain symbols that collide with the actual definition of the keyword under the cursor. So now I use different shortcuts for ctags and lsp-based definition. --- init.lua | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/init.lua b/init.lua index d081e9d..215d6b7 100644 --- a/init.lua +++ b/init.lua @@ -335,19 +335,13 @@ require'lazy'.setup{ --{{{1 end, }) - -- Honors tags file local function jump_to_definition() local word = vim.fn.expand("") - 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 + vim.cmd("tag " .. word) end - vim.keymap.set( 'n', ',fd', jump_to_definition, { noremap = true, silent = true}) + vim.keymap.set( 'n', ',fc', jump_to_definition, { noremap = true, silent = true}) + vim.keymap.set( 'n', ',fd', vim.lsp.buf.definition, { noremap = true, silent = true}) vim.cmd [[ noremap ,rn :lua vim.lsp.buf.rename() @@ -529,9 +523,6 @@ require'lazy'.setup{ --{{{1 noremap ,fm :lua require'telescope.builtin'.marks() noremap ,fb :lua require'telescope.builtin'.buffers() - noremap ,fcm :lua require'telescope.builtin'.commands() - noremap ,fct :lua require'telescope.builtin'.tags() - noremap ,fea :lua require'telescope.builtin'.diagnostics() noremap ,fee :lua require'telescope.builtin'.diagnostics{severity="ERROR"} noremap ,few :lua require'telescope.builtin'.diagnostics{severity="WARN"}