回复内容:
一般来说只需要正确设置vim的编码识别序列就很少会遇到乱码问题:
<code class="language-vim"><span class="k">set</span> <span class="nb">fileencodings</span><span class="p">=</span>ucs<span class="p">-</span>bom<span class="p">,</span>utf<span class="m">-8</span><span class="p">,</span>utf<span class="m">-16</span><span class="p">,</span>gbk<span class="p">,</span>big5<span class="p">,</span>gb18030<span class="p">,</span>latin1
</code>
登录后复制
看到之后直接打开我本机的vimrc给你贴出来,用了2年了还没遇到乱码
set fileencodings=utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
如果是编码的问题 可以考虑使用:e ++enc=utf-8 myfile.txt 试试
Debian下vim中文乱码的解决方案:
1、设置~下的.vimrc文件,加上fileencodings、enc、fencs,代码如下:
<code class="language-bash"><span class="nb">set </span><span class="nv">fileencodings</span><span class="o">=</span>utf-8,gb2312,gb18030,gbk,ucs-bom,cp936,latin1
<span class="nb">set </span><span class="nv">enc</span><span class="o">=</span>utf8
<span class="nb">set </span><span class="nv">fencs</span><span class="o">=</span>utf8,gbk,gb2312,gb18030
</code>
登录后复制
切换字体试一试,通常都是因为vim使用的是西文字体导致的,你把字体换成楷体试一试。