tags:

views:

273

answers:

1

I am using mvim . I am trying to map keys so that I could visually select elements then I could indent the code inward or outward. However while doing outward work after every keystroke one more line at the bottom get selected. What is the fix.

" Ctrl-x - move the block of visually selected code one tab right and keep visual mode alive
" Ctrl-z moves the data in opposite direction
" Usage : shift v and select multiple lines. then Ctrl x multiple times and
" then Ctrl z multiple times
vmap <C-x> >gv  
vmap <C-z> <gv  
+4  A: 

Why would you go to the trouble when you already can do this?

>> - increase indent of selected block

<< - decrease indent of selected block

This will cause you to lose the focus. If you want to continue indenting just type . to repeat the last action. You can also type gv to re-select your last selection.

Another option is to select and type a number before indenting, which is the same as repeating the >> or << as many times as the number you typed.

Nathan Fellman
because >> lose focus . so you need to keep tpying 44>> 44>> 44>>
Nadal
No you don't have to: 44>>..
Paul Rouget