Archive for June, 2017

How to exit Vi(m)

Monday, June 12th, 2017

So 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 or Ctrl-c will switch to command mode from insert mode.
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