How do I open separate tabs/windows for all buffers in Vim?

10

4

How do I easily open my current vim buffers/arguments in a separate window/tab each?

I know about:

$ vim one.txt two.txt three.txt -O

However if I simply start vim with:

$ vim one.txt two.txt three.txt

How can I replicate this behaviour once I've already started vim?

Klaas van Schelven

Posted 2011-08-16T08:26:06.953

Reputation: 397

Answers

18

To split all buffers use :sba or :vert sba

dogbane

Posted 2011-08-16T08:26:06.953

Reputation: 3 771

3

Vim command :sba has also a shortcut: :ba.

:[N]ba[ll] [N] :[N]sba[ll] [N] Rearrange the screen to open one window for each buffer in the buffer list.

To back again to single tag, use: :on (:only).

:on[ly][!] Make the current window the only one on the screen. All other windows are closed.

To quit, use: :qa

See also: How to convert all windows into horizontal, vertical or tab splits? at Vim SE

kenorb

Posted 2011-08-16T08:26:06.953

Reputation: 16 795

1

How to convert buffers to windows/tabs:

  • buffers > horizontal windows: :ba (buffer all)
  • buffers > vertical windows: :vert ba (vertical buffer all)
  • buffers > tabs: :tab ba (tab buffer all)

How to convert window/tabs to buffers:

  • windows > buffers: :on, :only (current window only)
  • tabs > buffers: :tabo, :tabonly (current tab only)

If you want to convert all windows to tabs, first convert windows to buffers, then buffers to tabs:

:on | tab ba

wisbucky

Posted 2011-08-16T08:26:06.953

Reputation: 1 522

0

Answering part of my own question:

How do I easily open my current vim buffers/arguments in a separate window/tab each?

:tab all

Klaas van Schelven

Posted 2011-08-16T08:26:06.953

Reputation: 397