created March 18, 2005 · complexity basic · author Salman Halim · version 5.7
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.