Vim: How to Quit Without Saving
The easiest way to exit the vim editor is by using the :q!
command. The steps are outlined in detail below:
- Press the
ESC
key to exit out of insert/append mode into command mode - Then, press the colon key
:
- You will now be able to enter your command. Type q followed by an exclamation mark:
q!
- 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.

And, that's how we do it, folks! Check out our vim cheatsheet for an extensive list of vim commands to have at your disposal.