Last Updated: February 25, 2016
·
593
· glauco

Indenting entire file in Vim

Edit your ~/,vimrc file and add the following lines:

filetype plugin on
filetype indent on

On normal mode, just type:

gg=G

2 Responses
Add your response

This only works if you have the filetype plugin and indent on. To have these enabled edit the ~/,vimrc file and add the following lines:

filetype plugin on
filetype indent on

only after you add those lines to the .vimrc file will the gg=G automatically indent files based on their file type.

over 1 year ago ·

Darrell,

I just updated my protip based on your comment.

Thank you! :)

over 1 year ago ·