Vim Cheatsheet

Auto Indent Entire File

If you want to autoindent a file you're on, use the following keyboard shortcut:

gg=G

So basically you use gg to get to the start of the file, = to indent and G to get to the end of the file.

Delete all text in a file

If you want to delete all of the text in file you're in, use the following keyboard shortcut:

1G
dG

Resources

http://stackoverflow.com/questions/506075/how-do-i-fix-the-indentation-of-an-entire-file-in-vi
http://stackoverflow.com/questions/8124315/how-i-can-delete-in-vim-all-text-from-current-line-to-end-of-file