Command-line mode is entered through normal mode. You will know you are in command-line mode when there is a :
in the bottom left corner of your terminal window.
Normal mode is the default mode of vi/vim and can be switched to by pressing the ESC.
Vi/Vim have built-in checks to prevent unsaved work from being lost and other useful features. To bypass these checks, use the override !
in your command.
In Vi/Vim it is possible to have more than one file displayed (in different windows) at the same time. Use a
to close all the opened windows.
:wq
ZZ
:q!
:q!
ZQ
:wq!
:qa!
:wqall
Exiting multiple files with saving contents
:qall!
Exiting multiple files without saving contents
Parameter | Details |
---|---|
: | Enter command-line mode |
w | Write |
q | Quit |
a | All |
! | Override |