Is there a command in Vim/gVim to combine two or more tabs into a single split window?

Jason Down picture Jason Down · Jan 6, 2011 · Viewed 8k times · Source

Is it possible to take two files that are open in separate tabs in gVim and combine them into one tab with a split/vsplit window? I'd prefer if there was a way to specify which tabs to join, but even something that is the opposite of :tab ball would be good enough.

Thanks

Answer

Zsolt Botykai picture Zsolt Botykai · Jan 6, 2011

Lots of handwork but...

:tabnew
:buffers "note the numbers
:split
:bn " where n is the number of 
<CTRL-W><CTRL-W>
:bn " for the other file
:tabonly " not necessary, closes every other tab

Or you can create a function for it which asks for buffer numbers, then creates the tab, and closes every other tab (for the opened files)...