4

When I move over a key word and then hit ^], it will jump to the definition in thecurrently active split. How can I keep the current split the same and instead open the definition in another split window (either vertical or horizontal)?

stdcerr
  • 253
  • 4
  • 12

2 Answers2

7

<C-]> doesn't jump to the reference of the word under the cursor, it jumps to its definition.

Anyway, you can use <C-w>] to open the tag in a new window.

See :help window-tag.

romainl
  • 23,415
1

You can remap ^] with the following commands:

nnoremap <C-]> :only<bar>vsplit<CR>:execute "tag" . expand('<cword>')<CR>

Put that in your .vimrc and restart vim.

Reference:

  1. https://stackoverflow.com/a/33603586/4752883
alpha_989
  • 1,131
  • 12
  • 14