Tip 977 Printable Monobook Previous Next
created August 26, 2005 · complexity basic · author iyerns · version 5.7
You can press gg=G to quickly format the whole file, but you will be at the begining of the file after that. To format and still remain in the same line where you were, just add this mapping to your vimrc:
map <F7> mzgg=G'z<CR>
Now, just press <F7> whenever you want to format your file.
Comments
There is a variation of this that does not use marks. See VimTip83 for more.
TODO Maybe change tip title ('align' is incorrect).