2009/10/28 anna klein <[email protected]>:
>
>
> On Wed, Oct 28, 2009 at 1:20 PM, winterTTr <[email protected]> wrote:
>>
>> 2009/10/28 anna <[email protected]>:
>> >
>> > Hi,
>> >
>> > I found error "E16:Invalid range". This is how to reproduce it.
>> >
>> > :function! Foo()
>> > :echo "foo"
>> > :endfunction
>> > :nmap x :call Foo()<CR>
>> >
>> > If I input "x" or "2x" in  normal mode, it behaves as expected,
>> > echoing "foo". However, if input "3x" or greater range, then it throws
>> > me error E16:Invalid range".
>>
>> when you press a number before the map key , the function will be
>> called as follow
>>
>> 1x
>> :.call Foo()
>> 2x
>> :.,.+1call Foo()
>> 3x
>> :.,.+2call Foo()
>>
>> and , so on
>>
>> so , if the range specified before the function is out-of-range , the
>> E16 would be shown.
>>
>
> I don't understand why the function can be out-of-range?

The "function" is not out-of-range , I mean that , the "range string"
( such as 1,100 ) before the function is out-of-range.

For example ,
if you define a function like :

function! Foo()
    "do nothing
endfunction

Then , you don't run it thought the map key this time ,
but run the function directly by the "range string"
:1,100call Foo()
If there are not 100 lines in your file , the same error warning will
be shown, right ?

And the same thing happens  when you map it to a key and press
[number] + [ key ]
As i say before , the vim will convert the [number] + [key] to the sequence
: . , .+[number-1] call Foo()

# "." means the current line

and you can reference more help about "call" via
:h :call




>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to