How to exit VIM – VI Editor

VIM stands for Vi IMproved. As in a better editor than VI.

You can start Vim at any terminal or in a SSH session on Linux with this command:

vim filename
vim /home/me/filename
vim

Same goes for vi commands, opens a file the same way.

vi filename
vi /home/me/filename
vi

Once vim / vi is opened you are in the default mode.

Editing the file is done by pressing i key or Insert on the keyboard.

To exit vim you type colon: 

then that should show on the bottom left side of the screen. 

If it says — INSERT — on bottom left, press the Esc escape key and press: again. Now the: showuld show on bottom left area.

If you didn’t make changes to the file you can exit vim (quit) by pressing q and Enter key.

If you did make changes but don’t want to keep them you press q! and Enter.

If you made changes and you would like to write them to disk / file, you type wq and Enter.

Keys Summary

Keyboard characters sequences

:q - exit vim
:q! - exit vim without saving changes
:w - save write changes to disk but not closing vim
:wq - save changes to disk then quit vim. This is the most used option.

Hope it helps.

Helpful Tips

Check all labels, connections, and power ratings before starting so everything fits safely and securely. If any detail looks slightly different on your model, pause the embedded video above for a clear closeup view.


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.