Go to definition in new tab

how would i change
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()<cr>', opts)
to do this?

is there something similar in How to jump to definition in new or existing tab · Issue #318 · neoclide/coc.nvim · GitHub i can do?

1 Like

There’s no option, you’ll have to override the location handler

With neovim 0.6 you could setup the lsp tagfunc (:help vim.lsp.tagfunc()) and then use <c-w><c-]><c-w>T

See :help CTRL-W_] and CTRL-W_T

vim.api.nvim_buf_set_keymap(bufnr, "n", "gdt", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts) worked for me

1 Like

I’m using this:

    nmap <buffer> gd <plug>(lsp-definition)  # go to definition in current window
    nmap <buffer> gD :tab LspDefinition<cr>  # go to definition in new tab
1 Like