Set the vim character set, in order to determine whether Vim is not a character set problem, can be used after vim file: set Encoding=utf8 see if it can be displayed properly. The ultimate solution to vim garbled is to change the environment variables of VIM, as follows:
VI ~/.VIMRC Add set Encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936 then save, then vim with Chinese files you find garbled problem no
The UNIX developer decided to use a <LF> character to denote the end of the line.
Apple developers have defined <CR>.
the development of MS-DOS (Windows) developers decided to follow <CR><LF>.
This means that moving a file from one system to another has the trouble of line breaks. such as: Use VI to try to edit a file in MS-DOS format, you will find the end of each line has a ^m character. (^m is <CR>).
set Ff=unix, which is to tell the VI editor to use UNIX line breaks
set Ff=dos, which is to tell the VI editor to use DOS line breaks
This article from "It Technology" blog, declined reprint!
Processing of Linux text editing garbled problem