7

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

I am not trying to indent multiple lines.

4 Answers 4

8

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? Commented 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 Commented 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. Commented Jan 31, 2023 at 20:08
7

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.

4

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
  • This is basically the same answer as alpha_989's Commented Feb 2, 2023 at 16:19

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.