How to quit Vim (in five seconds)

#archive

This post is out of date

This post has been migrated from my old blog. It may have broken links, or missing content.

Press escape, type :q (colon q), and press enter.

It’s a long-standing joke that quitting Vim is incredibly hard, but the above should work in pretty much every situation. Let’s unpack it.

Pressing escape to return to normal mode

Vim is a modal text editor, meaning that you can enter different modes to do different things. By default, Vim is in normal mode, which allows you to use the hjkl keys to navigate your document. There’s also insert, visual, command-line, select, and ex — for now, we’ll just focus on getting out of those modes into normal mode. You can do this by pressing the ESC (escape) key.

Type :q (colon q) and press enter

You can enter commands into Vim by pressing the colon (:) key. You should see a colon (and whatever you type next) in the command bar at the bottom of your Vim window.

Now, you can use the q command (short for quit) to quit command. Press enter, and you’ll be back out of Vim.


If you want to learn the rest of Vim, check out my video tutorial on getting started. It’s a little old, but like Vim, it still works splendidly. Enjoy!