How to Exit Vim (Stuck in Vim)
Workaround available Linux, macOS, Windows, WSL Updated October 21, 2026
Quick answer
Press Esc to get back to Normal mode, then type :q and Enter. Use :q! to quit without saving or :wq to save and quit.
Most likely fix: Quit the normal way.
Symptoms
Typing 'exit' or 'quit' just inserts text, Ctrl+C shows 'Type :qa! and press <Enter> to abandon all changes and exit Vim', and the terminal seems stuck. Often happens after git commit opens Vim as the default editor.
Why it happens
- Vim is modal: keys typed in Insert mode become text, not commands
- Git, crontab and other tools open Vim as the default $EDITOR without warning
- Unsaved changes block :q with E37
How to fix it
Try these in order — the most common fix is first.
1. Quit the normal way
- Press Esc (twice if unsure) to return to Normal mode
- Type :q and press Enter to quit
- If Vim says E37: No write since last change, use :q! to discard or :wq to save
2. Use the shortcuts
- In Normal mode, ZZ saves and quits
- ZQ quits without saving
- :qa! quits all windows and discards everything
3. Stop Git from opening Vim
- Run git config --global core.editor "nano" (or "code --wait")
- Or set export EDITOR=nano in your shell profile
4. Learn the basics once
- Run vimtutor in a terminal, or :Tutor inside Vim 9.2+
- It covers modes, saving and quitting in about 30 minutes
This guide also covers
- how to exit vim
- how to quit vim
- vim exit without saving
- stuck in vim git commit
Still not working?
If Vim keeps failing, you're not alone. See every Vim problem users report or the alternatives people switch to.
Other Vim errors
- Vim Copy to Clipboard Not Working
- Vim E325: ATTENTION Found a Swap File
- Vim E212: Can't Open File for Writing
- Vim E37: No Write Since Last Change
- Vim Backspace Not Working in Insert Mode
- Vim Paste Indentation Messed Up (Staircase Effect)
- Vim Colors Wrong in tmux
- Why Is Vim So Slow? (Large Files & Long Lines)
- Vim Arrow Keys Insert A B C D
- Vim Requires Python 3 Support Error (YouCompleteMe)
- Vim Modeline Vulnerability CVE-2026-34982