Fandom

Vim Tips Wiki

Some tips on saving the document

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 897 Printable Monobook Previous Next

created 2005 · complexity basic · author Salman Halim · version 6.0


I use the following mappings to save my document -- they do away with the need for hitting escape when I'm in visual or insert modes.

nmap <c-s> :w<CR>
vmap <c-s> <Esc><c-s>
imap <c-s> <Esc><c-s>

However, control-s will freeze some computers; if that happens, hit control-q to get out it.

In most Unixes you can disable control-S by doing this:

/bin/stty stop undef

The F2 series of mappings are different; they only write if needed (performing an update) and return you to where you were: insert mode, visual selection etc.

nmap <F2> :update<CR>
vmap <F2> <Esc><F2>gv
imap <F2> <c-o><F2>

So, if you're done with a particular operation, hit control-s (or whatever you come up with as a replacement); if you're not done, but want to save (just to be safe), use the F2 series of mappings.

CommentsEdit

Also on Fandom

Random Wiki