History Report a problem
Article Edit this page Discussion

Quickly align whole file

From Vim Tips Wiki

Jump to: navigation, search
 

Tip 977Previous TipNext 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).


Rate this article:

Share this article:

Hubs Highlights International Sites Wikia messages
Entertainment
Gaming
Cartoons & Comics
Science Fiction
Hobbies
Sports
See all...
Grand Theft Auto
Terminator Wiki
Legend of Zelda Wiki
Flash Gordon
Everquest II Wiki
Yo-Yo Wiki
German
Spanish
Chinese
Japanese
More...
Wikia is hiring for several open positions
Send this article to a friend
"Quickly align whole file"
 
 
Hi!

I thought you'd like this page from Wikia!

http://vim.wikia.com

Come check it out!
Send confirmation