Enable vim to automatically save

Source: Internet
Author: User
& Nbsp; vim is my favorite editor and can't write emails without it. Therefore, I have been using the combination of Thunderbird2.0 + ExternalEditor + vim to write emails. Recently, Google's Japanese input method has been installed. Unfortunately, it is not compatible with vim, and it often causes vim to exit abnormally during Chinese character conversion.

 


Vim is my favorite Editor that can't even write emails. Therefore, I have been using the combination of Thunderbird 2.0 + External Editor plug-in + vim to write emails. Recently, Google's Japanese input method has been installed, but its compatibility with vim is not very good. it often causes vim to exit abnormally when the Chinese character is changed, and half of the emails it writes will become a bubble. So I thought it would be nice if vim could be automatically saved. After studying the help file today, we found that the function similar to automatic storage can be realized.

The method is simple. you only need to add the following line to $ VIM/vimfiles/ftplugin/mail. vim:

Au InsertLeave *. eml write indicates that the write command is automatically executed when the edit mode (InsertLeave) is exited for all. eml files. In this way, it is automatically saved every time you press Esc.

By the way, paste other useful configurations:

Set encoding = utf8
Set guifont = MS _ 0000000000000000: h10: cSHIFTJIS
Set tw = 140 "140 character automatic line feed
Set et "expandtab, replacing the Tab key with spaces
Retab "convert all existing tabs into spaces when vim is opened
Au InsertLeave *. eml write "is automatically saved every time you exit insert mode.

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.