>
> Hi,
>
> Taylor Hedberg wrote:
> > rcvim, Tue 2012-04-10 @ 12:24:57-0700:
> >> Suppose I have text file that includes a vertical column of zip codes.
> >> I want to yank 10 codes so I move to the desired upper left corner and
> >> hit ctrl-v, then move the cursor down 10 rows and over 5 columns. Now
> >> I have selected a 5x10 set of characters. Suppose I realize I started
> >> in the wrong spot and instead wanted to start *down* three rows. I
> >> know I could use the o command to switch ends and move the endpoint
> >> rows up and down... but my dream is to instead be able to hit
> >> something like ctrl-j to move the 5x10 selection window around without
> >> modifying the size of the 5x10 window. Anyone know how to do it?
> >
> > Is this what you're looking for?
> >
> > vnoremap <C-J> jojo
> > vnoremap <C-K> koko
>
> this won't work if you give a count, e.g. "3<C-J>", because the count is
> only applied to the first command in the mapping. Better define the
> mappings like
>
> vnoremap <expr> <c-j> 'jo'.v:count1.'jo'
> vnoremap <expr> <c-k> 'ko'.v:count1.'ko'
>
> or
>
> vnoremap <c-j> @='jojo'<cr>
> vnoremap <c-k> @='koko'<cr>
>
> Regards,
> Jürgen
>
> --
> Sometimes I think the surest sign that intelligent life exists elsewhere
> in the universe is that none of it has tried to contact us. (Calvin)
>
> --
> 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
Can you explain (or give :help hint) how @= works here that makes the trick.
Thanks,
Marcin
--
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