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.
This commit is contained in:
@@ -335,19 +335,13 @@ require'lazy'.setup{ --{{{1
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Honors tags file
|
|
||||||
local function jump_to_definition()
|
local function jump_to_definition()
|
||||||
local word = vim.fn.expand("<cword>")
|
local word = vim.fn.expand("<cword>")
|
||||||
local success = pcall(vim.cmd --[[@as function]], "tag " .. word)
|
vim.cmd("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', ',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 [[
|
vim.cmd [[
|
||||||
noremap ,rn :lua vim.lsp.buf.rename()<CR>
|
noremap ,rn :lua vim.lsp.buf.rename()<CR>
|
||||||
@@ -529,9 +523,6 @@ require'lazy'.setup{ --{{{1
|
|||||||
noremap ,fm :lua require'telescope.builtin'.marks()<CR>
|
noremap ,fm :lua require'telescope.builtin'.marks()<CR>
|
||||||
noremap ,fb :lua require'telescope.builtin'.buffers()<CR>
|
noremap ,fb :lua require'telescope.builtin'.buffers()<CR>
|
||||||
|
|
||||||
noremap ,fcm :lua require'telescope.builtin'.commands()<CR>
|
|
||||||
noremap ,fct :lua require'telescope.builtin'.tags()<CR>
|
|
||||||
|
|
||||||
noremap ,fea :lua require'telescope.builtin'.diagnostics()<CR>
|
noremap ,fea :lua require'telescope.builtin'.diagnostics()<CR>
|
||||||
noremap ,fee :lua require'telescope.builtin'.diagnostics{severity="ERROR"}<CR>
|
noremap ,fee :lua require'telescope.builtin'.diagnostics{severity="ERROR"}<CR>
|
||||||
noremap ,few :lua require'telescope.builtin'.diagnostics{severity="WARN"}<CR>
|
noremap ,few :lua require'telescope.builtin'.diagnostics{severity="WARN"}<CR>
|
||||||
|
|||||||
Reference in New Issue
Block a user