[Next] [Up] [Previous] [Contents]
Next: Copydelete, and Up: Command mode Previous: Deleting text

Saving and quitting


     :w    write to disk
     ZZ    write to disk and exit
     :q!   exit without writing to disk
Actually, the command for quitting vi is :q. You can save and quit by typing :wq but ZZ does the same thing[+] and takes one less keystroke. If there are unsaved changes to the text and you try to quit using :q, vi will warn you that you have unsaved changes and will prevent you from quitting. In order to quit without saving the changes you must use the override switch, !.


c.c.taylor@ieee.org