Vim: How to Quit Without Saving

graphic of open windows

Related: Vim cheatsheet

Vim Cheatsheet
Complete list of commands and shortcuts to navigate around the world of Vim / Vi.

The easiest way to exit the vim editor is by using the :q! command. The steps are outlined in detail below:

  1. Press the ESC key to exit out of insert/append mode into command mode
  2. Then, press the colon key :
  3. You will now be able to enter your command. Type q followed by an exclamation mark: q!
  4. Then, press enter

And that's all. Your document will close without saving any of the changes that you have made.

Related: How to select all in Vim

How To ‘Select All’ in Vim
In this guide, we cover the main methods with which you can select all in the vim/vi editor.