OpenWindows Advanced User's Guide

6.3.1 Saving Changes and Quitting vi

vi is rich in more or less synonymous commands that control saving the buffer contents to a file and quitting vi. These commands give you the option of saving, saving-and-quitting, or quitting-without-saving. Saving

Save the contents of the buffer (write the buffer to the file on disk) by typing:


followed by Return. Saving and Quitting

Save and quit by typing:


followed by Return. Alternatively, type ZZ.

Note that the command ZZ is neither preceded by a colon nor followed by Return. Quitting Without Saving

When you've made no changes to a file and simply want to quit, type:


followed by Return. If you have made changes, vi will not let you quit with :q. Instead, it will display the message, No write since last change (:quit! overrides).

If you do not want to save your changes, type:


followed by Return.