Vim Tips Wiki
(Change to TipImported template + severe manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
|previous=996
 
|previous=996
 
|next=998
 
|next=998
|created=September 21, 2005
+
|created=2005
 
|complexity=basic
 
|complexity=basic
|author=Anon
+
|author=
 
|version=6.0
 
|version=6.0
 
|rating=5/10
 
|rating=5/10
  +
|category1=
  +
|category2=
 
}}
 
}}
To save a file, we do &lt;tt&gt;&lt;Escape&gt; :w &lt;Enter&gt;.&lt;/tt&gt;
+
To save a file, we do <code><Esc>:w<Enter></code>.
   
 
If you add the following line to your vimrc, you can easily save a file by pressing F2.
 
If you add the following line to your vimrc, you can easily save a file by pressing F2.
 
 
<pre>
 
<pre>
map &lt;F2&gt; :w! &lt;CR&gt;
+
map <F2> :w! <CR>
 
</pre>
 
</pre>
   
 
==Comments==
 
==Comments==
I just press <tt>ZZ</tt> to save and exit.
+
I just press <code>ZZ</code> to save and exit.
   
 
----
 
----
 
F2 is too far away from where I keep my fingers - I prefer the following:
 
F2 is too far away from where I keep my fingers - I prefer the following:
 
 
<pre>
 
<pre>
 
map W :wa^M
 
map W :wa^M

Latest revision as of 06:02, 13 July 2012

Tip 997 Printable Monobook Previous Next

created 2005 · complexity basic · version 6.0


To save a file, we do <Esc>:w<Enter>.

If you add the following line to your vimrc, you can easily save a file by pressing F2.

map <F2> :w! <CR>

Comments[]

I just press ZZ to save and exit.


F2 is too far away from where I keep my fingers - I prefer the following:

map W :wa^M
map! ^W ^[:wa^Ma

This makes W save all buffers in command mode and Ctrl+W do the same in insert mode.