1) If you are currently in insert or append mode, press Esc key.
2) Type : (colon). You will see the cursor at the lower left corner of the screen.
3) Type the following command:
The above command returns you to the last saved version of the file i.e. edit the current file always. Discard any changes to the current buffer. This is useful if you want to start all over again. Type the following command for more information.
Check out related media
This tutorial is also available in a quick video format:
Video 01: VI / VIM: Wipe All Changes To The Buffer / File