Save and Exit Vim
Before you see anything else, you should know how to exit Vim, either with saving your changes or discarding them.
To save or exit Vim, you must enter the command mode first by pressing Esc key.
And then you can use the following options:
- :w – Save the changes but don’t exit
- :wq – Save and quit
- :q – Just Quit (if you have unsaved changes, you’ll see this warning: E37: No write since last change (add ! to override))
- :q! – Force quit (it will discard any unsaved changes)
That's it. Now that you know how to quit the Vim editor, you can see some editing tips.
Abhishek Prakash
Creator of Linux Handbook and It's FOSS. An ardent Linux user & open source promoter. Huge fan of classic detective mysteries from Agatha Christie and Sherlock Holmes to Columbo & Ellery Queen.