Quickly align whole file
From Vim Tips Wiki
Tip 977 • Previous Tip • Next Tip
Created: August 26, 2005 Complexity: basic Author: iyerns Minimum version: 5.7 Karma: 90/74 Imported from: Tip#977
You can press gg=G to quickly format the whole file, but you will be at the beginning 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.
[edit] Comments
There is a variation of this that does not use marks. See VimTip83 for more.
TO DO
Maybe change tip title ('align' is incorrect).
Categories: Review | VimTip | Todo
