Jump to definition in vertical/horizontal split

Hi,

one of the most basic things when navigating code is jumping around, and Neovim with LSP does it perfectly. With a large screen it’s convinient to jump to definitions in a vertical or horizontal split, so the context of the currently open file is not lost.

How can I do this with Neovim?

I tried to:

  • search documentation (":help lsp" and searching for “split”, “jump” and “definition”) - no luck
  • search github, found this closed issue, which has no answer except “This can be done with basic vimscript.”.
  • searched this forum - found only this topic, it discusses alternative file opening in vsplit for clangd

Basically I need to find/guess two commands similar to vim.lsp.buf.definition() that do the same but one is for vertical split and other for horizontal
I believe this should be come as a default commands.

Any ideas how to implement this?

2 Likes