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

How do I open any split command's result in a new tab instead of a split window?

Answer

:tab {cmd}

Explanation

Most commands that open a new window (:help, :split, :new, :terminal) open a horizontal split by default. Prefixing any of these with :tab redirects the result into a brand-new tab page instead. This is a general modifier that works across almost any window-creating command.

How it works

  • :tab is a command modifier, not a standalone command.
  • It intercepts any window-opening operation and opens the result in a new tab page.
  • The modifier works with built-in commands and most plugin commands that call :split or :new internally.

Example

Open help in a new tab instead of a split:

:tab help registers

Other useful combinations:

:tab split          " open current buffer in a new tab (same as <C-w>T)
:tab new            " new empty buffer in a new tab
:tab split filename " open a file in a new tab
:tab Man git        " open man page in a new tab (Neovim)

Tips

  • You can use a count: :0tab help topic opens the tab at the leftmost position.
  • Combine with :vertical for Neovim's :terminal: :tab terminal opens a terminal in a new tab.
  • If you always want help in a tab, add to your config: cnoreabbrev help tab help.
  • :tab drop filename opens the file in a new tab only if it is not already open in another tab.

Next

How do I rename a variable across all its case variants (camelCase, snake_case, SCREAMING_CASE) in one command?