Wikia

Vim Tips Wiki

Saving file made easy

Talk0
1,613pages on
this wiki
Revision as of 06:02, July 13, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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