In that case I'd like to make a feature request for a way to handle
functions with ranges without moving the cursor. My suggestion would be
adding a [save] argument to :function which calls winsaveview() before
entering and winrestview() after exiting the function, as this has
potential applications beyond just [range] functions.

Thoughts on the proposed api?


On Tue, Nov 20, 2012 at 9:54 AM, Andy Wokula <[email protected]> wrote:

> Am 20.11.2012 17:48, schrieb Christian Brabandt:
>
>  On Tue, November 20, 2012 17:46, Ingo Karkat wrote:
>>
>>> I omit the range attribute on the function and explicitly pass the
>>> range
>>> in:
>>> #v+
>>>      function! s:Foo( firstLine, lastLine )
>>>         ...
>>>      endfunction
>>>      command! -range=% Foo call <SID>Foo(<line1>,<line2>)
>>> #v-
>>>
>>
>> Yes, that was what I meant initially.
>>
>
> That works pretty well (for hidden implementation (<sid>Name() etc)
> functions).
> Just don't use this for a (global) function that can be used
> (interactively) at the cmdline ... it's impractical for the user to pass
> a range then.
>
> --
> Andy
>
>
> --
> You received this message from the "vim_dev" 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<http://www.vim.org/maillist.php>
>

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui