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. 1. Quit the normal way

    1. Press Esc (twice if unsure) to return to Normal mode
    2. Type :q and press Enter to quit
    3. If Vim says E37: No write since last change, use :q! to discard or :wq to save
  2. 2. Use the shortcuts

    1. In Normal mode, ZZ saves and quits
    2. ZQ quits without saving
    3. :qa! quits all windows and discards everything
  3. 3. Stop Git from opening Vim

    1. Run git config --global core.editor "nano" (or "code --wait")
    2. Or set export EDITOR=nano in your shell profile
  4. 4. Learn the basics once

    1. Run vimtutor in a terminal, or :Tutor inside Vim 9.2+
    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