Thursday, December 30, 2021

Exiting vim editor

1. Press the Esc key.

2. You should see the ––INSERT–– label vanish from the lower-left.

3. Press either of these options

:w – write out changes that were made

:q – exit Vim

:q! – exit Vim and discard any changes

:wq – saves the changes, and exits Vim

:x – save the changes made, and exits Vim


Exit Vim Using a Shortcut Key

In addition to command mode, Vim also has the option for shortcut keys:

To save a file in Vim and exit, press Esc then "Shift + ZZ"

To exit Vim without saving, press Esc then press "Shift + ZX"