Sometimes, when using vim to edit a file, for various reasons forget or too late to manually save (in the last line mode: w! and led to the cost of a lot of effort to do the changes lost, have to re-create, I have personally encountered 3 times, in line with the principle of charm, decided to study vim automatic saving function.
First try the best solution for VIM auto-save? http://segmentfault.com/q/1010000000592658 "has been unsuccessful, know why the students welcome advice.
Second, try Https://github.com/907th/vim-auto-save, here's how:
? wget Https://github.com/907th/vim-auto-save/archive/master.zip
? Unzip Master.zip
? Mkdir-p ~/.vim/{plugin,doc,syntax}
? CP Vim-auto-save-master/plugin/autosave.vim ~/.vim/plugin/
? ~ Vim ~/.vim/plugin/autosave.vim
; Permanently open AutoSave mode
"Let G:auto_save = 0"
G:auto_save = 1
In the cursor insertion mode call AutoSave, I can't find the Completedone event on my Mac (from the 7.3.598 patch start,vim 7.4 is supported), so comment out, otherwise error
"Au Cursorholdi,completedone * call AutoSave ()
Au Cursorholdi * call AutoSave ()
Error message:
? ~ VIM/USERS/LAIJINGLI/.VIMRC
Error detected while Processing/users/laijingli/.vim/plugin/autosave.vim:
Line 39:
E216:no such group or Event:completedone * Call AutoSave ()
Press ENTER or type command to continue
Done.
Reference: http://www.ibm.com/developerworks/cn/linux/l-vim-script-5/
VIM enables real-time auto-save with event-driven