Reindent an entire file
ggVG=
gg Goes to the first line
V Enters visual mode
G Goes to last line
= Reindents current selection
Written by Jesper Petersson
Related protips
5 Responses
This is even shorter (you don't need to go to visual mode)
gg=G</code></pre>
over 1 year ago
·
Is this different from :retab ?
over 1 year ago
·
@s1na
Yes, this is different.
:retab converts tabs to spaces, or spaces to tabs
gg=G fixes indentation level
over 1 year ago
·
@vimrocks Thanks, I didn't know that. Awesome!
over 1 year ago
·
@vimrocks
Ah, great. Thanks ;)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Related Tags
#vim
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#