If I want to indent all lines in a document, I can type
>G to apply it to the current line and below, followed by and
>gg to apply it to the lines above.
Is there a combination I can use to just apply
> to all lines at once?
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 community
You are looking for the
:> command and a range of
% for short) for the whole file.
For more help see:
:h :> :h :range
One way to indent all lines in a document:
Without leaving normal mode you can simply do:
Another option that has not been mentioned yet:
This will run the command
> on all lines that match the pattern
Downside is that this will overwrite your search history.