To exit Vim:
- If you are in edit mode, first press the esc key.
- Then enter
:wq+ return to save and exit.
To exit without saving, you can run :q! + return
To exit Vim:
:wq + return to save and exit.To exit without saving, you can run :q! + return
For further actions, you may consider blocking this person and/or reporting abuse
Latest comments (18)
Please can someone tell me why this rugged editor is worth using.
I find it COOL but FRUSTRATING.
I wish I could find the original where I saw this...
Gandalf, reading a battered old file from the server:
I was taught to pronounce :wq as "write and quit" and :q! As "quit, dammit". 😊
😂
It's day 728
I'm still stuck in Vim
With 2.54839e30 possible key-press combinations, it has become evident that my human typing capabilities alone are not going to brute force the phrase that will allow my exit
I am now on the 7th revision of my quantum computer program in an attempt to solve this issue
Send help
😂
To remember when to use
:wqand:q!without getting confused, I always say it out loud.wq = write (to disk) and quit
q! = quit without writing (to disk)
:saveas filename
Ctrl-Z
... shell commands
fg
To exit without saving, I suggest
:!kill -9 $PPIDCome now, we're just scratching the surface...
Given you're in command mode:
:wqawill write, quit all buffers (in case you have more than one):xwill also save and quit:exas aboveZZwill save and quitZQwill just quit:1,5wqwill save only lines 1 to 5 and quitThere's more. A lot more. Interested?
:h quitwill take you to the Vim help section on quitting.Haha! Absolutely! I was hoping for comments just like this. Thank you, and keep the Vim tricks coming!
Some comments may only be visible to logged-in visitors. Sign in to view all comments.