Exiting Vim

Other topics

Remarks:

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.

Exit with save

:wq

ZZ

Exit without save

:q!

Exit forcefully (without save)

:q!

ZQ

Exit forcefully (with save)

:wq!

Exit forcefully from all opened windows (without save)

:qa!

if multiple files are opened

:wqall

Exiting multiple files with saving contents

:qall!

Exiting multiple files without saving contents

Parameters:

ParameterDetails
:Enter command-line mode
wWrite
qQuit
aAll
!Override

Contributors

Topic Id: 5074

Example Ids: 17903,17904,17905,17906,19356,29776

This site is not affiliated with any of the contributors.