How to Exit Vim
You opened the editor. You got stuck.
đź§ą The Sensible, Everyday Exits
:q— Quit if nothing changed.:q!— Quit and don’t save.:wq— Save and quit.:x— Save only if needed and quit.ZZ— Save and quit, old‑school.ZQ— Quit without saving, old‑school.
đź§Ş The Slightly Less Normal
:wthen:q— Because why do it in one step.:w filenamethen:q— Save your work somewhere else and bail.:cq— Quit with an error code, for when you want your shell scripts to feel pain.:qa— Quit all buffers.:wqa— Save and quit all buffers.:qa!— Quit all buffers even if they scream.
🧯 The “I’m Getting Annoyed” Tier
:!kill -9 $PPID— Terminate the parent shell and hope Vim goes down with it.:!pkill vim— Vim can’t trap a kill signal if you’re fast enough.:!shutdown -h now— If the computer is off, Vim can’t hurt you.:!reboot— Same logic, but with optimism.
🧨 The “I Refuse to Learn Vim” Tier
- Close the terminal window.
- Close the entire terminal application.
- Force‑quit the terminal application.
- Log out of your user session.
- Switch to another TTY and kill Vim from there.
- SSH into your own machine from your phone and kill Vim remotely.
- Physically unplug the computer.
That's the whole trick. Really.
Unless you came here for the fun. People do that.