When you've made no changes to a file and want to quit, type:
:q |
Press Return. If you have made changes, vi does not let you quit with :q. Instead, it displays the following message.
No write since last change (:quit! overrides) |
If you do not want to save your changes, type:
:q! |