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:
Command | Action | Alias |
---|---|---|
:quit | quit current window (when one window quit Vim) | :q |
:quit | quit current window (when one window quit Vim) | :q! |
ZQ | close window without writing | |
:wq | write to a file and quit window or Vim | |
ZZ | write if buffer changed and close window | |
:wqall | write all changed buffers and quit Vim | :wqa |