moll / vim-bbye

Delete buffers and close files in Vim without closing your windows or messing up your layout. Like Bclose.vim, but rewritten and well maintained.
http://www.vim.org/scripts/script.php?script_id=4664
Other
654 stars 32 forks source link

Bdelete unable to delete multi buffers #6

Open sheeaza opened 8 years ago

sheeaza commented 8 years ago

when I try to delete multi buffers with :Bdelete 4 6 it doesn't work leaving the words like this "no math for 4 6" 4 and 6 are buffers' name

moll commented 6 years ago

Thanks for letting me know. You're right, this case isn't handled right now. At some point I guess it should be. :)

vds2212 commented 1 year ago

Thanks very much for BBye :-)

In the same spirit I noticed that Bdelete doesn't support range:

:%Bdelete

Is there a good reason for that or are you open for a Pull-request implementing it?

vds2212 commented 1 year ago

I have created a Pull request #21 that support:

moll commented 1 year ago

Thanks again. I'll leave this open instead if you don't mind as a reminder to come back to it someday and review whether the built-in :bdelete supports multiple buffers and under what syntax.

vds2212 commented 1 year ago

Thanks for your interest for the pull request.

Here is the corresponding excerpt from the documentation

:[N]bd[elete][!]            *:bd* *:bdel* *:bdelete* *E516*
:bd[elete][!] [N]
        Unload buffer [N] (default: current buffer) and delete it from
        the buffer list.  If the buffer was changed, this fails,
        unless when [!] is specified, in which case changes are lost.
        The file remains unaffected.  Any windows for this buffer are
        closed.  If buffer [N] is the current buffer, another buffer
        will be displayed instead.  This is the most recent entry in
        the jump list that points into a loaded buffer.
        Actually, the buffer isn't completely deleted, it is removed
        from the buffer list |unlisted-buffer| and option values,
        variables and mappings/abbreviations for the buffer are
        cleared. Examples: >
            :.,$-bdelete    " delete buffers from the current one to
                    " last but one
            :%bdelete       " delete all buffers
<

:bdelete[!] {bufname}                       *E93* *E94*
        Like ":bdelete[!] [N]", but buffer given by name, see
        |{bufname}|.

:bdelete[!] N1 N2 ...
        Do ":bdelete[!]" for buffer N1, N2, etc.  The arguments can be
        buffer numbers or buffer names (but not buffer names that are
        a number).  Insert a backslash before a space in a buffer
        name.

:N,Mbdelete[!]  Do ":bdelete[!]" for all buffers in the range N to M
        |inclusive|.

In particular the following are valid commands:

Multiple arguments: :bdelete 2 4 5 Ranges: :%bdelete, :2,4bdelete or :2bdelete

And the pull request intention is only to provide their :Bd counterpart.

The one that I'm using the most is :%Bd.