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