xxxxxxxxxx
:q to quit (short for :quit)
:q! to quit without saving (short for :quit!)
:wq to write and quit
:wq! to write and quit even if file has only read permission (if file does not have write permission: force write)
: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)
:cq to quit without saving and make Vim return non-zero error (i.e. exit with error)
xxxxxxxxxx
Multiple ways to exit Vim:
Get a new PC.
Burn your PC at stake.
You don't.
xxxxxxxxxx
press ESC to go into command mode then
exit without saving
:q
exit without saving if you made changes
:q!
for saving and quitting
:wq
hope that helps
xxxxxxxxxx
Contemplate your career choice and cry yourself to sleep. It won't exit you out of Vim but it'll lessen the pain
xxxxxxxxxx
Exit Vim in Terminal
Press the Esc key.
You should see the ––INSERT–– label vanish from the lower-left.
To save your changes before you exit, type :w , and then Enter. This will save any changes made.
To exit Vi/Vim, type :q and hit Enter.
xxxxxxxxxx
1.Type something in the file
2.Press esc
3.Type in :q! or :wq! followed by the "enter" key to save and quit the terminal