Skip to content
This repository
tree: 1563771179
Fetching contributors…

Cannot retrieve contributors at this time

file 35 lines (25 sloc) 1.488 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
<h3 id="quitting-vim">Quitting Vim</h3>

<h4>Problem</h4>

<p>You've finished using Vim and now you want to close the program.</p>

<h4>Solution</h4>

<p>To save the changes in the current file then quit use <tt>:x</tt><span
  class="fn">The more usual suggestion for saving then quiting is
  <tt>:wq</tt>. We use <tt>:x</tt> here because it only saves the file if it
  has been changed, thus preserving its timestamp and saving needless disk
  access.</span>. In Normal mode you use <kbd>ZZ</kbd>.</p>

<h4>Discussion</h4>

<p>The way you quit Vim depends on what you want to quit (the whole program,
or just the current window) and what you want to do with your unsaved
changes.</p>

<p>As mentioned above, if you're using a single window either <tt>:x</tt> or
<kbd>ZZ</kbd> will save any unsaved changes, and exit Vim. </p>

<p>To exit and discard your changes you use <tt>:q!</tt> (mnemonic:
<b>q</b>uit in a possibly dangerous (exclamatory) manner). </p>

<p>You can also quit on the condition that there are no unsaved changes with
<tt>:q</tt>; if you do need to save Vim warns you <samp>E37: No write since
  last change (add ! to override)</samp>.</p>

<p>If you're using multiple windows the above commands will act upon the
current window. To quit all windows use <tt>:qa</tt> (mnemonic: <b>q</b>uit
<b>a</b>ll). Vim will prompt you to save any changes. To quit all windows
without saving use <tt>:qa!</tt> (mnemonic: <b>q</b>uit <b>a</b>ll in a
possibly dangerous manner).</p>
Something went wrong with that request. Please try again.