loading...

How to Exit Vim

serhatteker profile image Serhat Teker Originally published at tech.serhatteker.com on ・1 min read

Yes, we all have been there: You are stuck and cannot escape Vim. It says:

"type :quit<Enter> to quit VIM"

Here is the solution to escape from this dead-end hell:

  1. Press Esc key.
  2. Hit :
  3. Press wq (q short for quit, w for write/save)
  4. Hit Enter

If you dont want to save the changes you made in the file use q! instead of wq.

For more

'quit' Alternatives

  • :x to write and quit (similar to :wq, but only write if there are changes)
  • :exit to write and exit (same as :x)
  • :qa to quit all (short for :quitall)
  • :1,5wq will save only lines 1 to 5 and quit

Shortcut Alternatives

After pressing Esc:

  • ZZ will save and quit
  • ZQ will just quit

Discussion

markdown guide