Vim encoding settings

Source: Internet
Author: User

 I had a headache with vim coding and searched for it.
The following code variables are used to set VIM:

Encoding: the encoding used by VIM to process data <br/> fileencoding: the encoding used for File Reading and Writing (only one value can be added) <br/> fileencodings: the encoding used for File Reading and Writing (with multiple values) <br/> 


Therefore, the problem may occur in fileencoding (s) and encoding when our files are garbled.
In fact, we only need to ensure that Vim can correctly identify the encoding. In general, I don't think there will be any problem if fileencodings is set:
PS: in windows, the setting document is _ vimrc in the installation path, and in Linux, the setting document is $ home/. vimrc.

Set fileencodings = UTF-8, gb2312, GBK "when we open a file, VIM will match the encoding in the UTF-8, gb2312, and GBK order. 





What if we want to convert a file from GBK to UTF-8?
In Vim command line mode, enter:
: Sets fileencoding = UTF-8
: W # Save

 

 

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.