Yakov Lerner wrote:

> I get error 'E16: Invalid range' when I give large count
> (larger than number of lines in current buffer) to the ':10000call X()'
> where function is declared with 'range' attribute.
> 
> I think the error is illogical in this case. I think this error must
> not appear when function has 'range' attribute. Count is not alway
> line numbers.
> 
> There are many examlpes of builtin commands where count is not
> line numbers. These builtin commands correctly do not give error
> when [count] is larger than num. of buffer lines. For example,
> ':20verb set' correctly does not give error in buffer with <20 lines.
> 
> Yakov
> 
> Here is testcase
> 
> :so x.vim   "see x.vim below
> :5XXX         " this works since 5 is less than lines in buf
> :10000XXX  "gives error  "E16: Invalid range"
> 
> ------------ begin file x.vim --------------------
> command! -range XXX  :<count>call XXX()
> 
> function! XXX() range
>     echo a:firstline
>     echo a:lastline
> endfu
> ------------ end file x.vim --------------------

If you want to pass a number that is not a line number you need to use
-range=N, where N is the default number.

-- 
It is illegal for a driver to be blindfolded while operating a vehicle.
                [real standing law in Alabama, United States of America]

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to