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

4

23

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

Araarab answered 6/1, 2011 at 14:19 Comment(0)
S
9

There are a couple of functions published on the “Move current window between tabs” page in Vim Tips Wiki that should do what you want, or be easily modifiable to get exactly what you want.

Shanel answered 6/1, 2011 at 17:19 Comment(1)
I modified the script so I can split vertically or horizontally when pulling the buffer over (I prefer vertical splits most of the time, but figured why not have the option). Thanks again for the link!Araarab
R
14

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)...

Rockaway answered 6/1, 2011 at 15:39 Comment(1)
This is just what I needed: :buffers to see the numbers, saw that the buffer I wanted to pull was 12, then with my cursor in the target pane, :b 12. Then buffer 12 is open in both places so just close the other one.Glume
S
9

There are a couple of functions published on the “Move current window between tabs” page in Vim Tips Wiki that should do what you want, or be easily modifiable to get exactly what you want.

Shanel answered 6/1, 2011 at 17:19 Comment(1)
I modified the script so I can split vertically or horizontally when pulling the buffer over (I prefer vertical splits most of the time, but figured why not have the option). Thanks again for the link!Araarab
B
1

Try this script:

TabMerge http://www.vim.org/scripts/script.php?script_id=1961

Benil answered 5/11, 2011 at 20:12 Comment(0)
C
1

This one worked for me: TabMerge

If you're working with Plug, just add the following to your ~/.vimrc:

Plug 'vim-scripts/Tabmerge'

Contact answered 10/6, 2019 at 7:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.