How to exit vim?

There are millions of developers on this planet who doesn’t know how to exit from this extraordinary text editor.
This very simple website is an effort to help them overcome this obstacle.
Just follow the steps below to learn how to exit vim.

Step 1 - Make sure you are in "NORMAL" mode

Press ESC once to switch into normal mode. You should see vim display the current mode somewhere on the screen.

Active mode in vim is displayed towards the bottom of the screen

Step 2 - Enter into command line mode

You have to press : once to start typing a command. You should see the prompt move to the bottom.

Command line in vim is the bottom most line of the screen preceeded by a colon

Step 3 - Exit vim with the right command

If you want to save changes type wq to exit vim.

Command wq has been appeared in the command line of vim

If you want to discard changes type q! to exit vim.

Command q! has been appeared in the command line of vim

If you don’t have changes type q to exit vim.

Command q has been appeared in the command line of vim
GitHub icon