As we have already seen in advanced Vim tips, there are multiple ways to quit Vim. Let me list them one by one along with the procedure.
- Press Esc key: This is very important because you must exit the edit mode first before typing the exit command(s). Next, you can type one of the following commands:
- :q (yes, the colon is included in the command) – This will quite the editor
- :q! – Quit Vim without saving the data file
- :wq – Save the file and exit Vim
- And then Enter key
Do note that when you press :, the editor will have the next keystrokes displayed at the bottom left of the terminal.

Other ways to exit Vim
Normally, you should remember the above three commands and you should be good with exiting Vim. But as I said earlier, there are more shortcuts to quit Vim. These are following:
- Esc + :x + Enter (Save and exit)
- Esc + :qa + Enter (Quit all open files)
- Esc + Shift ZZ (Save and exit)
- Esc + Shift ZQ (Exit without saving)
Now it is really up to you to choose how you want to quit Vim editor. If you ask me, the first method is what you should opt for.
Because you save (without exiting) with :w command and then you can use :wq to save and quit (w for save and q for quit). It is easier to remember q for quit.