vimtricks.wiki Concise Vim tricks, one at a time.

How do I open a tag definition in a new split window?

Answer

<C-w>]

Explanation

The <C-w>] command opens the definition of the tag under the cursor in a new horizontal split. This lets you view the definition and the calling code side by side.

How it works

  • <C-w>] splits the window and jumps to the tag in the new split
  • The original window stays at the current position
  • Works with the same tag files as <C-]>

Example

With the cursor on processData in your code, pressing <C-w>] splits the screen and shows the definition of processData in the top split.

Tips

  • <C-w>} opens the tag in a preview window instead
  • :stag function_name does the same by tag name
  • :vertical stag name opens in a vertical split
  • Use with ctags for effective code browsing

Next

How do you yank a single word into a named register?