| ZZ | Quit vi, writing the file only if changes were made. | 
| :x | Same as ZZ. | 
| :wq | Write and quit file. | 
| :w | Write file. | 
| :w file | Save copy to file. | 
| : n1,n2wfile | Write lines n1 ton2to newfile. | 
| : n1,n2w >>file | Append lines n1 ton2to existingfile. | 
| :w! | Write file (overriding protection). | 
| :w! file | Overwrite filewith current buffer. | 
| :w %. new | Write current buffer named fileasfile.new. | 
| :q | Quit file. | 
| :q! | Quit file (discarding edits). | 
| Q | Quit vi and invoke ex. | 
| :vi | Return to vi after Qcommand. | 
| :e file2 | Edit file2without leaving vi. | 
| :n | Edit next file. | 
| :e! | Return to version of current file at time of last write. | 
| :e# | Edit alternate file. | 
| % | Current filename. | 
| # | Alternate filename. |