How to convert split windows to tabs and vice versa in Vim

扶醉桌前 提交于 2019-12-21 13:09:23

问题


For example, I use 3 split windows to open 3 different files:

    +---------------+-----------+                          
    |               |           |                          
    |   window 1    |           |                          
    |               |           |                          
    +---------------+           |                          
    |               | window 3  |                          
    |               |           |                          
    |   window 2    |           |                          
    |               |           |                          
    |               |           |
    +---------------+-----------+

Now, I want to open them with 3 different tabs and vice versa

Is there any trick to achieve this? Or do I need any plugin?

Besides, if I want to display 3 buffers in 3 full screen windows (as opposed to a split window), what should I do?


回答1:


Not sure if there is a plugin, which will do all splits at once. But there is a way to do it one at a time

For moving the current split into a new tab use ctrl + w, T (shift + t)

repeat the above process for all splits.

Now for getting the tab in to split, you can make use of a plugin call "Tabmerge", download Tabmerge.vim from http://www.vim.org/scripts/script.php?script_id=1961 to ~/.vim/plugin

then to merge the tab use :Tabmerge [tab number] [top|bottom|left|right]




回答2:


If you are careful with your buffer list, you can use :sball and :tab sball to open in windows or tabs, respectively.



来源:https://stackoverflow.com/questions/28313975/how-to-convert-split-windows-to-tabs-and-vice-versa-in-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!