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

How do I open all listed buffers as separate tabs at once?

Answer

:tab ball

Explanation

:tab ball (short for :tab sball, "split all buffers in tabs") opens every listed buffer in its own tab page in a single command. This is useful when you have been editing multiple files in the background and want to switch to a tab-based workflow, or when you want a quick visual overview of all open buffers as named tabs.

How it works

  • :tab ball — opens all listed buffers, one per tab
  • Buffers already visible in the current window layout are reused; new tabs are created for the rest
  • The command is idempotent: running it again won't create duplicate tabs

Example

Suppose you have opened several files:

:e foo.py
:e bar.py
:e baz.py

All three are listed buffers but only baz.py is visible. Running:

:tab ball

produces three tabs: one for foo.py, one for bar.py, one for baz.py. You can navigate them with gt and gT.

Tips

  • :tabdo bd closes all tab pages and their buffers — the reverse operation
  • :tab split opens just the current buffer in a new tab without affecting others
  • Pair with :args **/*.go first to load a set of files, then :tab ball to view them all as tabs
  • For the reverse (collapse tabs back to buffers), use :tabonly to close all but the current tab

Next

How do I programmatically set a register's content in Vimscript to pre-load a macro?