Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to indent multi-line in vim/gvim?

Tags:

vim

shortcut

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

like image 582
Tanky Woo Avatar asked Mar 24 '12 10:03

Tanky Woo


2 Answers

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).

like image 92
Joni Avatar answered Oct 24 '22 19:10

Joni


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).
like image 31
Birei Avatar answered Oct 24 '22 21:10

Birei