OneZero
OneZero

Reputation: 11914

Auto-indent the whole text file shortcut?

What's the shortcut for autointenting the whole text file (like .c files or .java files). It should be equivalent to the tab in emacs but I couldn't find a correct way to do this online.

Upvotes: 1

Views: 653

Answers (2)

FDinoff
FDinoff

Reputation: 31469

To reindent the whole file can be done with.

gg=G

gg moves to the top of the file.
=G reindents from the cursor position to the end of the file.

Upvotes: 6

krisharav
krisharav

Reputation: 485

In addition to @FDinoff's suggestion, you could also use autocmd/au for user-defines filetype indentation settings. Like so-

au FileType c setl sw=8 ts=8 noet (For C);

au FileType python setl sw=4 ts=4 et (for python)

and so on..

Upvotes: 0

Related Questions