vim-bbye icon indicating copy to clipboard operation
vim-bbye copied to clipboard

Bdelete unable to delete multi buffers

Open sheeaza opened this issue 8 years ago • 5 comments

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

sheeaza avatar May 24 '16 07:05 sheeaza

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

moll avatar Mar 03 '18 11:03 moll

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 avatar Jan 09 '23 10:01 vds2212

I have created a Pull request #21 that support:

  • Multiple arguments: :Bdelete 2 4 5
  • Ranges: :%Bdelete, :2,4Bdelete or :2Bdelete

vds2212 avatar Jan 23 '23 14:01 vds2212

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.

moll avatar Sep 23 '23 11:09 moll

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.

vds2212 avatar Sep 27 '23 06:09 vds2212