Exiting


Although the various ways to exit Vim might not be obvious to new users, it is actually quite simple. The basic command for exiting is :quit, which has several variations, summarized in the table below:

CommandActionAlias
:quitquit current window (when one window quit Vim):q
:quitquit current window (when one window quit Vim):q!
ZQclose window without writing
:wqwrite to a file and quit window or Vim
ZZwrite if buffer changed and close window
:wqallwrite all changed buffers and quit Vim:wqa