Like doing >>
but 5 times >>>>>>>>>>>>
.
I am not trying to indent multiple lines.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityYou 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 .
:>
to indent multiple lines multiple times?
Feb 24, 2022 at 14:21
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
:.,+4>>
to add two indents to the current and next 4 lines (5 lines total). Then you can @:
to repeat it.
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 shiftwidth
s 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.
Press shift-v
to visually select the line, or block of lines.
Then in normal mode press
10>
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.