How to Exit Vim_

You opened vim. It's been a while. Here is every known way out.
Tap any command to copy it.

~/help-im-stuck — vim
1 I just wanted to edit one config file.
~
~
~
"help-im-stuck" [+] 1 line, 41 bytes

↑ real(ish) vim. click it and try to escape — type :q! then Enter, or just ZZ.

The Normal Ways

:q QuitOnly works if you haven't changed anything. copy
:q! Quit without savingThe one you actually wanted. Discards all changes. copy
:wq Write and quitSave your changes, then exit. copy
:x Save and quitLike :wq but only writes if there were changes. copy

The Cool-Kid Shortcuts

ZZ Save and quitNormal mode, capital Z twice. No colon needed. copy
ZQ Quit without savingNormal mode, Z then Q. The fast bail-out. copy

First, Are You Even In Normal Mode?

  1. Mash Esc a few times. This gets you out of insert/visual mode.
  2. Now type :q! and press Enter.
  3. If you see :q! appear as text in the file — you're still in insert mode. Go back to step 1.

The Nuclear Options

Ctrl+Z Suspend itDrops vim to background. Then run kill %1 to end it. copy
pkill pkill -9 vimFrom another terminal. Force-kills every vim. Unsaved work is gone. copy
🔥 Close the terminalBurn it all down. The computer can be replaced. copy
Copied ✓