On 05/03/09 07:36, Maxim Kim wrote:
>
>
> On 5 мар, 05:57, Tony Mechelynck<[email protected]> wrote:
>> On 04/03/09 20:30, Maxim Kim wrote:
>>>> map ,ff :<c-u>call Hello(v:count)<CR>
>>> function! Hello(count)
>>> "do smth useable here a:count
>>> echo a:count
>>> endfunction
>>> command! -count Hello call Hello(v:count)
>>> map ,ff :Hello<CR>
>
>> Without<C-U> this will convert whatever count you prepended to the
>> mapping to a range of (count) lines starting at the cursor line.
>>
>> See ":help v:count" for details, and an example.
>
> <C-U> has no effect on :command stuff. Just on functions?
> Do I miss something?
> function! Hello(count)
> "do smth useable here with a:count
> echo a:count
> endfunction
> command! -count Hello call Hello(v:count)
> map ,ff :<C-U>Hello<CR>
> "map ,ff :Hello<CR>
>
Ctrl-U (see ":help c_CTRL-U") removes everything left of the cursor (but
not the colon) on the command-line.
When you type a count, then hit the colon, Vim will automatically insert
a range of (count) lines starting at the cursor line. For instance 5:
becomes :.,.+4
When you hit the colon key in Visual mode, Vim will get out of Visual
but it will insert the range '<,'> meaning "all lines of the former
Visual area". (Ex-command ranges are always linewise.)
In both these cases, a mapping whose {rhs} starts with :<C-U> will
insert a range as a reselt of the colon, then immediately remove the range.
Best regards,
Tony.
--
Keep America beautiful. Swallow your beer cans.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---