Tanky Woo
Tanky Woo

Reputation: 5106

How to indent multi-line in vim/gvim?

I want to indent multi-line in 'vim/gvim', is there any shortcut in the vim/gvim?

Upvotes: 13

Views: 15685

Answers (2)

Joni
Joni

Reputation: 111219

The indent commands =, < and > can be combined with all movement commands and text objects. For example:

>G     Indent until end of file
>}     Indent until next paragraph
>iB    Indent contents of current { } block

They also indent text selected in visual mode.

Use < to un-indent or = to re-indent ('format' using the filetype settings).

Upvotes: 20

Birei
Birei

Reputation: 36262

Yes. Try:

V             # To switch to visual mode. Select lines, and...
>             # Indent (use `<` to de-indent, or with a number just before to indent several times).

Upvotes: 5

Related Questions