Code with Kristian • I make videos and write about software development and programming tools

How to quit Vim (in five seconds)

It's been thirty years since you opened Vim, and you still haven't found a way to leave. Let's teach you how to quit Vim in just five seconds.

How to quit Vim (in five seconds)

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!

Enjoying these posts? Subscribe for more

Subscribe to be notified of new content and support Code with Kristian! You'll be a part of the community helping keep this site independent and ad-free.

You've successfully subscribed to Code with Kristian
Great! Next, complete checkout for full access to Code with Kristian
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.