Launch and Quit Vim

Michael Chan
InstructorMichael Chan

Share this video with your friends

Send Tweet
Published 2 years ago
Updated 10 months ago

Quitting Vim is something that thousands of developers struggle with every day. Fortunately, for the astute, Vim tells us how to quit right on the launch screen.

Quitting Vim requires a mindset shift. Where most editors open in a persistent insert mode, Vim defaults default mode is different. It's known as normal mode and it allows you to type commands. Quit is one of those commands...

Michael Chan: [00:00] To launch Vim in a terminal, type Vim, the name of the program, and hit Enter. Opening Vim like this gives us a launch screen with important information on it -- how to get help, and how to quit.

[00:12] Unlike traditional editors, which only have an insert mode, Vim's default mode lets you issue commands. We quit by typing :q and hitting Enter.

[00:24] This shift can be very disorienting if you only used editors that default to insert mode, which would insert the text as you start typing. Vim does not default to insert mode.

[00:36] If you want to quit and don't have a handy-dandy launch screen, you can hit Ctrl-C, which is a commonly used command to halt terminal programs. This won't quit Vim, but it will prompt you with some details on how to quit. This message is getting truncated because I've zoomed in so far.

[00:53] I'll suggest that we use :qa, which will prompt us if we have any uncommitted changes, changes like my typing above here. If we don't care about those changes and don't mind discarding them, we can type :q! Or :qa! For all of the uncommitted files. That will force quit us out of them.

[01:13] That's it. That's how you launch and quit Vim.