Wednesday, May 20, 2015

Re: :1,9000bd is giving 'E16 invalid range' after update

Hi,

Wael Nasreddine schrieb am 20.05.2015 um 21:30:
> Jürgen Krämer <jottkaerr@googlemail.com> writes:
>
>>
>> Wael Nasreddine schrieb am 20.05.2015 um 10:42:
>>>
>>> I have this map in my vimrc:
>>>
>>> " Wipe out all buffers
>>> nmap <silent> <leader>wa :1,9000bd<cr>
>>>
>>> and it used to work fine on Vim 7.4.488[0] but since I've updated Vim to
>>> 7.4.712[1] it errors our with 'E16: Invalid range'. Is anyone else
>>> experiencing the same issue?
>>
>> there have been some changes that allowed "$" to be used as a placeholder
>> for the highest buffer number or tab number or whatever, depending on the
>> command following the range. In the course of this changes Vim has become
>> more strict in regard to numbers used in the range.
>>
>> You might want to try "$" instead of an arbitrary high number if you want
>> to include the last buffer in a range, thus
>>
>> nmap <silent> <leader>wa :1,$bd<cr>
>>
>> should be the preferred way to wipe out all buffers.
>>
>
> Cool that works! Do you know as of what version this has started? I'd
> like to do something like
>
> if v:version < 747
> nmap <silent> <leader>wa :1,$bd<cr>
> else
> nmap <silent> <leader>wa :1,9000bd<cr>
> endif

I think the base patch was 7.4.530, but there have been some more patches
for correcting some special cases, including patch 7.4.585 which solves a
problem with "range for :bdelete does not work". So your test should look
like

if v:version > 704 || (v:version == 704 && has('patch585'))

Note that has('patch585') does not tell you whether all patches before 585
have been included. It only checks the patch given as a parameter. But
because the patches regarding this feature build on each other, it's
probably save to check only for the last patch.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment