Field Guide for the Trapped

Quick fixes for when you just want to exit vim

Symptom: "Everything I type does weird stuff."

Likely cause: you're not in Insert mode.

Fix: press Esc once. Then once more because it's free.

Esc Esc

Symptom: ":q won't quit."

Likely cause: unsaved changes.

Fix options:

:wq   "save and quit
:q!   "quit without saving
:w    "save but stay in Vim
:u    "undo (repeat as needed)

Symptom: "I'm stuck in a prompt/search/help/something."

Likely cause: you're in a mini-mode inside Vim.

Fix: press Esc. If that didn't do it, press it again.

Esc Esc

Yes, I repeat that a lot. That's because it works a lot.

Symptom: "It's replaying a macro / I started something and it won't stop."

Likely cause: you're either recording a macro or playing one back.

If you're recording:

Press q again to stop recording.

q

If a macro is playing and you want it to stop right now:

Press Ctrl+C to interrupt, then press Esc to get back to Normal mode.

Ctrl+C
Esc

Bonus: if you were recording into a register like qa, the "stop" is still just q.