Hit the i key to enter “Insert mode”. Hit the Esc key to enter “Normal mode”. Then you can type : to enter “Command-line mode”. To execute a command, press the Enter key.
-
:qto quit (short for:quit) -
:q!/ZQto quit without saving (short for:quit!) -
:wqto write and quit -
:wq!to write and quit even if file has only read permission (if file does not have write permission: force write) -
:x/ZZto write and quit (similar to:wq, but only write if there are changes) -
:exitto write and exit (same as:x) -
:qato quit all (short for:quitall) -
:cqto quit without saving and make Vim return non-zero error (i.e. exit with error)
You can use
:help :quitto see more details