How to exit Vi(m)
Monday, June 12th, 2017So you have found yourself in vi or vim and are unable to exit. The following options are available.
First you need to get to command mode, so either hit
Then use the following:
Exit if there are no changes to the current buffer without writing
:q
Exit even though there are changes to the buffer without writing
:q!
Write and exit ( those are capital Zs)
ZZ
Exit and do not write
ZQ