Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #977 - Quickly align whole file

Created: August 26, 2005 6:02 Complexity: basic Author: iyerns Version: 5.7 Karma: 90/74 Imported from: Tip#977

gg=G would quickly align the whole file, but you will be at the beginiing of the file after that. To align 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 align your file.

I just use. Use whatever you prefer instead of <F7>.

Comments

There is a variation of this that does not use marks. See VimTip83 for more.

Anonymous , August 26, 2005 13:38


FYI: This operation is generally called "justification", not alignment.

Anonymous , September 7, 2005 12:38


wow~ your tiip is very helpful to me. thank you a lot!

have nice coding~ ^^

lepagats--AT--gmail.com , August 3, 2006 19:06


Advertisement