Monday, September 5, 2011

Re: Can a function tell if % range was explicitly passed?

On Aug 25, 6:42 pm, thinca <thi...@gmail.com> wrote:
> How about this?
>
> function RangeTest(range_given, line1, line2)
>   if a:range_given
>     echo printf('range was given: %s - %s', a:line1, a:line2)
>   else
>     echo 'range was not given.'
>   endif
> endfunction
> command -range=0 RangeTest call RangeTest(<count>, <line1>, <line2>)
>
> --
> thinca <thi...@gmail.com>

Sorry for the late reply, I've been away for a week.

This works very nicely as well. I've used this one to
update the CSV tip, since I wanted to try it out
as well as the other methods.

Thanks for all the replies, I've learnt a lot.

regards,
Geoff

--
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

No comments: