Use this tag for questions about exiting vim.

This tag is for questions about closing the vim text editor. From troubleshooting problems closing it, to configuring what happens when you close it.

By default, there are three ways to exit vim from normal mode:

  • :q<cr> This will quit without saving. If there are unsaved changes, you must add an exclamation mark to force it: :q!<cr>

  • :x<cr> This will quit and save.

  • ZZ This is just a synonym of :x<cr>

If you are using graphical vim (Gvim), you may also quit by clicking on the exit button on the window.