Indent several lines with VIM?
Press V
to switch to VISUAL LINE mode and highlight the lines you want to indent by pressing j
. Then press >
to indent them. So the complete command would be Vjjj>
.
Alternatively, put your cursor on the <script>
tag and use 4>>
to indent four lines.
To supplement the above answer, take a look here. https://stackoverflow.com/questions/235839/how-do-i-indent-multiple-lines-quickly-in-vi
There are more than one way to do this, and I can't hope to compete with documentation already provided there.
My personal favorite is ==
to auto-indent. 5==
to auto-indent 5 lines.
To indent the all the lines below the current line
=G
So, to indent entire file, go to the beginning of the file (gg
) and then indent all the lines below the current line (=G
)
gg=G
To indent the current line
==
So, to indent n
lines below the current line
n==
For example, to indent 4 lines below the current line
4==
These are the simplest commands to indent multiple lines.