8

I have a list of buffer in vim, how can I turn all of them into tab page like ones in, say Notepad++?

I know I can use :tabe or something to open new file in tab view, but what if I have opened several buffers in single vim and I want to turn all of them into tab pages?

FloydChen
  • 425
  • 1
  • 4
  • 9

3 Answers3

20

You can type this command:

:tab ball

It will display all buffers in tabs.

kev
  • 155,172
  • 47
  • 273
  • 272
  • In terms of reversing this process, you can simply close the tabs and _the buffers will still be filled_ (in GUI, right-clk ea. tab, ```close```). If you want to close all tabs and buffers ```:qa```. To save and close all all tabs and buffers ```:wqa``` – BentChainRing Aug 29 '19 at 17:44
  • @BentChainRing `:qa` will quit `vim`. `:tabo` or `:tabonly` will do the reverse, close all the tabs. – wisbucky Nov 13 '19 at 00:32
  • :tab ball where have you been all my life?!? :-) Thanks. – lzap Jun 10 '21 at 07:46
1

If I understood, you have several buffers in splits and wish every one of them in a separate tab. <Ctrl-w>T will open a buffer in a new tab page removing it from the split.

But tab pages are really not what they are in Notepad++ - separate files. In Vim they're more of a placeholders for splits, so my guess is you'll have a hard time working with them if you mean to just copy your Notepad++'s way of work to Vim.

Rook
  • 60,248
  • 49
  • 165
  • 242
  • 1
    Sorry I didn't make it clear, when I said the buffers are in single vim I didn't mean they were split, just that they were opened but you have to switch between them by using `:bn` stuffs. My question is how to switch between them by turning all buffers(as you see in `:ls`) into tabs so that, for example, I can click and switch them easily in gvim like in Notepad++. – FloydChen Jun 03 '12 at 07:17
  • @FloydChen - Think nothing of it. Glad you got your answer! – Rook Jun 03 '12 at 08:42
0

I don't know your motivations of to turn all buffers into tab pages. Usually, we have many buffers when doing one job, but for tabs, I think it don't have enough spaces to display the tabbars, especially in laptop. Imaging if there were 20 tabs on the top...

So if you want to turn the current buffer into tab page, you can use :tab split. I think it is what you exactly need.

You can see why-do-vim-experts-prefer-buffers-over-tabs for more help.

Tiger
  • 157
  • 2
  • 10