How to Exit Vim
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:
- Press
Esc
key. - Hit
:
- Press
wq
(q
short for quit,w
for write/save) - 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 quitZQ
will just quit
All done!
Changelog
- 2020-10-30 : Added post image
Subscribe
Read Related