1. Setting items that affect Chinese encoding
- Encoding (ENC): encoding is the internal use of Vim code, encoding settings will affect the internal vim buffer, message text and so on. In a UNIX environment, the default setting for encoding is equal to the locale;windows environment and the current code page. The default setting for encoding in the Chinese Windows environment is cp936 (GBK).
- FileEncoding (Fencs): Vim is saved when the new file is saved according to the fileencoding settings encoding. If you open an existing file, Vim saves it based on the encoding recognized when you open the file, unless you reset fileencoding on save.
- Termencoding (TENC): When using VIM in a terminal environment, the encoding used by the Vim terminal is told by Termencoding Word.
- Fileencodings (FENC): Vim will open the file according to the Fileencodings option to identify the file encoding, Fileencodings can set multiple encodings at the same time, Vim will be based on the order of settings to guess the encoding of the open file.
2. Set to support UTF-8
Set Encoding=utf-8
Note:
Set vim internal code to Utf-8
3. How to stay permanently active
First step: Create a configuration file
Touch/root/.vimrc
Step Two: Modify the configuration file
Set Encoding=utf-8
Note:
Vim-related configuration files
(1)
/etc/vimrc
(2)
/root/.viminfo
(3)
/root/.vimrc
Custom
Vim Chinese coding problem