[vim/vim] [n1,n2]bdelete raises `E16: Invalid range` if buffer n1 or n2 has been wiped out (#2014)

73 views
Skip to first unread message

Lifepillar

unread,
Aug 23, 2017, 5:41:18 AM8/23/17
to vim/vim, Subscribed

When using [range]bdelete, if one of the extremes of the range has been wiped out, then Vim gives an E16: Invalid range. For instance:

vim -u NONE -N file1 file2
:1bw
:1,2bdelete

This works as expected, however:

vim -u NONE -N file1 file2 file3
:2bw
:1,3bdelete

I think that the first example should work as the second one, i.e., it should ignore non-existing buffers.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Christian Brabandt

unread,
Aug 23, 2017, 12:16:13 PM8/23/17
to vim/vim, Subscribed

That is to be expected, since 1 is no valid buffer number anymore. I would suggest using %bd, that should set the index correctly

Lifepillar

unread,
Aug 23, 2017, 12:23:39 PM8/23/17
to vim/vim, Subscribed

Thanks for the info. I think that a symbol denoting “the first buffer”, in the same way as $ denotes “the last buffer”, would make sense then, but I can live with the current behaviour. Feel free to close this.

lacygoill

unread,
Apr 5, 2021, 11:09:16 AM4/5/21
to vim/vim, Subscribed

Fixed by 8.1.1908. Although, that was not the purpose of the patch.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Apr 5, 2021, 11:22:44 AM4/5/21
to vim/vim, Subscribed

Closed #2014.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Reply all
Reply to author
Forward
0 new messages