views:

148

answers:

4

I've found several answers on how to indent multiple lines in vim, I want to know how to take a single line and indent it more than once. In effect, I want a shorter version of the following command: ">>>>>>>>>>" (That is 10 right bracket "greater-than" signs.)

+12  A: 

Select what you want (usually easiest with Shift+v) then type 5>.

ldog
Why shift+v? v alone will work fine.
strager
Just a matter of preference, I like to see the whole line selected.
ldog
Thank you. You just improved vim for me markedly. :-)
T.J. Crowder
10 right-brackets is 5 indents, so the answer should be `5>`.
Jay
+3  A: 

You can select the current line by pressing v, and then type 5> to indent the current line 5 times, the equivalent of pressing > 10 times.

meagar
Current line is `V`, not `v`
Daenyth
Daenyth is right, but it is moot. You only have to be in visual mode; whether line-select or not is irrelevant in this case.
Jay
+1  A: 

Indent once the use . to redo the previous command or u to undo it.

Tudorizer
+2  A: 

One of the answers to "How do I indent multiple lines quickly in vi" showed me a neat trick to remap > in visual mode to reselect visual mode. In your .vimrc...

vnoremap < <gv
vnoremap > >gv

Then I just select the line (or lines) you want to indent and press the appropriate direction as many times as you want.

dash-tom-bang