eTechtips

Tech Tips and Insights

How to exit Vi(m)

/

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

Loading

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.