Pages

Showing posts with label Quit vi. Show all posts
Showing posts with label Quit vi. Show all posts

Friday, December 28, 2012

How to Exit vi

Press escape to get into command mode if you re not already in command mode (i.e. if you are in insert/edit mode) .. Even if you are not in the edit mode press escape any way, it s OK. 

So, press esc, then

type one of these:

:q to quit and dont save
:q! to quit with out saving changes or prompts (if you have made changes)
:w to save
:wq to save and quit 


:x to save and quit 


emacs - ^X^S to save, ^X^C to quit
esc shift^ZZ to save and exit.


Notes:

Adding an exclamation mark at the end of the command means "do it!" - as in  :q!

When you will press escape the "insert" mode will be disabled, then you need to type : After that you can provide q! or w or wq and hit enter.