Wikia

Vim Tips Wiki

Changes: Saving file made easy

Edit

Back to page

(change "anon" author to blank; trim "created" date; minor manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 12: Line 12:
 
|category2=
 
|category2=
 
}}
 
}}
To save a file, we do <tt><Esc>:w<Enter></tt>.
+
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.
Line 20: Line 20:
   
 
==Comments==
 
==Comments==
I just press <tt>ZZ</tt> to save and exit.
+
I just press <code>ZZ</code> to save and exit.
   
 
----
 
----

Latest revision as of 06:02, July 13, 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>

CommentsEdit

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.


Around Wikia's network

Random Wiki