6

Like doing >> but 5 times >>>>>>>>>>>>.

I am not trying to indent multiple lines.

4 Answers 4

7

You can use :>. Repeat > as many times as you want to shift. For example, if you want to shift 5 times use :>>>>>.

Personally, I would just use >> and then repeat the command with the . (repeat) command.

For more help see:

:h :>
:h >>
:h .
3
  • is there a hack for :> to indent multiple lines multiple times? Feb 24, 2022 at 14:21
  • Not that I am aware of. You can always use cmdline-window and a count with i/a to add many >, e.g. :<c-f>5><esc>. I do not think this is really faster or better Feb 24, 2022 at 15:10
  • You can do :.,+4>> to add two indents to the current and next 4 lines (5 lines total). Then you can @: to repeat it.
    – idbrii
    Jan 31 at 20:08
6

As an addition to Peter Rincker's answer, you can also enter visual-line mode (Shift+v) and use > with a count. Unlike in normal mode, the count is used to specify how many shiftwidths to indent.

If you prefer the comfort of giving a hard count, this is the only option that I'm aware of outside of a plugin or custom function.

3

Press shift-v to visually select the line, or block of lines.

Then in normal mode press

10>

0

The >takes a number input if a selection has been made. Select a chunk of text in visual mode v and then 5>to indent 5 times.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.