VIM enables real-time auto-save with event-driven

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.