On Mi, 29 Sep 2010, Bee wrote:
> Question? passing visual selection to function
> 
> The function BlkInc() puts line numbers at the start of line.
> 
> EXAMPLE 1 works
> EXAMPLE 2 does not work
Please explain what you expect and what you observe.
> Can you explain why?
> 
> ""-----=-------=-------=-------=-------=-------=-------=-------=
> " EXAMPLE 1
> function! BlkNum()
>   '<,'>s/^/\=BlkInc()/
> endfun
> vmap <F5> :<C-U>call BlkNum()<cr>
Here are you using the :s command on each visual selected line
> ""-----=-------=-------=-------=-------=-------=-------=-------=
> " EXAMPLE 2
> function! BlkNum()
>   s/^/\=BlkInc()/
> endfun
> vmap <F5> :call BlkNum()<cr>
This will probably only put your line number only in the first visual 
selected line, because your :s command does not know, on which range to 
act.
regards,
Christian
-- 
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:
Post a Comment