display all buffers in tabs?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

display all buffers in tabs?

Steve Hall-4

I must be missing something, is there a command to put all buffers
into their own tabs and at the same time remove them from the current
window? (This is gVim 7.0d, using guitabline.)

Using :set sessionoptions+=buffers starts a session with multiple
buffers in one window. The best I can do is to hack a loop closing and
then :tabedit each. But this has the horrid result of Vim having to
save, close, and re-open each file--when all the user wanted to do is
"menu" the existing buffers across the tab bar. All edits, save state,
marks, etc. should be preserved.


--
Steve Hall  [ digitect mindspring com ]


Reply | Threaded
Open this post in threaded view
|

Re: display all buffers in tabs?

Eric Arnold-3
Well, assuming you don't mean the "-p"  startup option, you could
"hide" the buffers prior to   :tabnew bufname , which avoids
saving/re-opening a file.

As for using the tab line as a "menu" of loaded buffers, this is why I
had each tab label of the non-GUI tabline list all buffers in that
tab, in "TabLineSet.vim".  I didn't add the GUI tab line function
since I liked the syntax highlighting of the non-GUI tab line, but it
would be simple enough to change the GUI tab line version to do the
same.

Since the doc.s say that  sessionoptions  doesn't handle multiple tabs
yet, I don't see a way  around adding your own loop to open new tabs
after restoring a session.



On 4/15/06, Steve Hall <[hidden email]> wrote:

>
> I must be missing something, is there a command to put all buffers
> into their own tabs and at the same time remove them from the current
> window? (This is gVim 7.0d, using guitabline.)
>
> Using :set sessionoptions+=buffers starts a session with multiple
> buffers in one window. The best I can do is to hack a loop closing and
> then :tabedit each. But this has the horrid result of Vim having to
> save, close, and re-open each file--when all the user wanted to do is
> "menu" the existing buffers across the tab bar. All edits, save state,
> marks, etc. should be preserved.
>
>
> --
> Steve Hall  [ digitect mindspring com ]
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: display all buffers in tabs?

Chris Allen
In reply to this post by Steve Hall-4
On 4/16/06, Steve Hall <[hidden email]> wrote:
> I must be missing something, is there a command to put all buffers
> into their own tabs and at the same time remove them from the current
> window? (This is gVim 7.0d, using guitabline.)

I'm not quite sure what you're asking, because the terminology is a
bit off.  Remember that in Vim a 'window' is a view into a single
buffer -- you can never have more than one buffer in a single window.
Regardless of what you mean, though, I think you'll find that one of
these does what you want:

    :tab all
    :tab ball

The first opens a tab for every argument in the argument list.  The
second opens one tab for every buffer in the buffer list.  This second
perhaps most adequately describes what it is that you want.

> Using :set sessionoptions+=buffers starts a session with multiple
> buffers in one window.

It can certainly start a session with one buffer loaded into one
window, and N hidden buffers, assuming you're loading from a
pre-existing session file.

> The best I can do is to hack a loop closing and
> then :tabedit each. But this has the horrid result of Vim having to
> save, close, and re-open each file--when all the user wanted to do is
> "menu" the existing buffers across the tab bar.

This is only true without 'hidden' set, but it is an less-than-perfect
solution.  I would hazard that ':tab ball' is what you're after here.

> All edits, save state, marks, etc. should be preserved.

You could use 'set hidden' to make that the case, or you can use the
commands I've suggested above.  I would recommend using 'hidden', as
well, since it is a very handy setting.

If you're working with session files you may wish to ensure that
'sessionoptions' includes 'tabpages' -- this will save any tabbed
layouts when you use :mks (and is the default).

Hope that helps,
Chris Allen
Reply | Threaded
Open this post in threaded view
|

Re: display all buffers in tabs?

Eric Arnold-3
On 4/16/06, Chris Allen <[hidden email]> wrote:
[...]
>     :tab ball

Hmm.  This not only opens buffers in new windows in new tabs, but
first seems to close/"hide" them all, which wasn't quite what I was
expecting from the way  :ball  works.  The doc.s don't really say that
it collapses any tab layouts you already have.  It does sound like
that's what Steve was asking for, though for myself, I'd rather it
opened new tabs and windows, and left alone what I've already set up.

>[...]
> If you're working with session files you may wish to ensure that
> 'sessionoptions' includes 'tabpages' -- this will save any tabbed
> layouts when you use :mks (and is the default).
>[...]

I couldn't get  :set sessionoptions+=tabpages  to work.  I see it in
"todo.txt", but ...
Reply | Threaded
Open this post in threaded view
|

Re: display all buffers in tabs?

Steve Hall-4
In reply to this post by Chris Allen
On Sun, 2006-04-16 at 09:08 +0100, Chris Allen wrote:

> On 4/16/06, Steve Hall <[hidden email]> wrote:
> >
> > I must be missing something, is there a command to put all buffers
> > into their own tabs and at the same time remove them from the
> > current window? (This is gVim 7.0d, using guitabline.)
>
> I'm not quite sure what you're asking, because the terminology is a
> bit off.  Remember that in Vim a 'window' is a view into a single
> buffer -- you can never have more than one buffer in a single
> window.

Sorry, I meant "tab" there at the end. I occasionally drop back to the
habit of the traditional meaning rather than Vim's. :)

> Regardless of what you mean, though, I think you'll find
> that one of these does what you want:
>
>     :tab all
>     :tab ball

Ah, the second one is is what I needed, I knew I was missing
something.

[snip]
> > All edits, save state, marks, etc. should be preserved.
>
> You could use 'set hidden' to make that the case, or you can use the
> commands I've suggested above.  I would recommend using 'hidden', as
> well, since it is a very handy setting.

Indeed, I do.

> If you're working with session files you may wish to ensure that
> 'sessionoptions' includes 'tabpages' -- this will save any tabbed
> layouts when you use :mks (and is the default).

This must be new since 7.0d, I get an E474 for that and it's not in at
:help 'sessionoptions.

Thanks much for the help.


--
Steve Hall  [ digitect mindspring com ]

Reply | Threaded
Open this post in threaded view
|

Re: display all buffers in tabs?

Steve Hall-4
In reply to this post by Eric Arnold-3
On Sun, 2006-04-16 at 03:52 -0600, Eric Arnold wrote:
> On 4/16/06, Chris Allen <[hidden email]> wrote:
> [...]
> >     :tab ball
>
> Hmm.  This not only opens buffers in new windows in new tabs, but
> first seems to close/"hide" them all, which wasn't quite what I was
> expecting from the way  :ball  works.  The doc.s don't really say
> that it collapses any tab layouts you already have.  It does sound
> like that's what Steve was asking for,

exactly

> though for myself, I'd rather it opened new tabs and windows, and
> left alone what I've already set up.

Not a preference for me, but as long as there is some way to get the
same behavior above another way, I could see others wanting this.


--
Steve Hall  [ digitect mindspring com ]