In vim there are 3 different modes:
- Insert - allows typing and editing as normal
- Visual - used for selecting copy/paste etc.
- Normal - used for commands
To get back to Normal mode, you can always press esc.
Once you are at Normal mode Press
: to begin your command (you’ll see it appear in the bottom left). The following commands are related to quiting vim:
:q - quit if no changes were made
:q! - quit and destroy any changes made
:wq - write changes (save) and quit
:x - similar to
:wq or ESC and ZZ, only write the file if changes were made, then quit