How to Exit

If you end up in vim without warning, you probably want to know: how do I get out of here?!


The basic shortcut is simply:


What does it mean?

When you type : (the colon character) you are telling vim to go into “command mode”. This is a special mode where you can tell vim to do things, in this case: quit!

The q means “quit”.

Save Changes

When you have changes, you either need to save them:


The w means “write”, aka “write file to disk”.

Ignore Changes

When you have changes, but you don’t want to save them:


The ! means “force” or “override the safety”.