VIM editor is a popular editor and one of the basic operations is How to close and exit the vim editor.

It is one of the basic and required steps to quit the vim editor.

This article explains multiple ways to close the editor.

How do I exit the Vim editor?

There are multiple ways to exit the Vim editor.

Here are the steps to close the editor.

  • First, Go to Normal mode by pressing the ESC key
  • Change to Command mode by typing a colon (:) and : appears bottom of the editor.
  • type one of the commands from one of the below command lists.
  • For example type :q or :quit to exit from the Vim editor

Following is a command list with different options to close the Vim editor

:q or :quitexit the current window by saving current changes, if one window exists, exit the editor
:q! or : quit!exit without saving current changes
:wqSave the current file and exit, if the file has readonly permissions, failed
:wq!Save the current file and exit, even for readonly permissions of a file
:x or :exitsave only for modifications and exit
:qa or :quitallexit all windows