问题描述
我不时处理涉及非英语脚本的网页,其中大部分使用 utf-8 字符集,VIM 和 Gvim 无法正确显示 UTF-8 字符.
I work on webpages involving Non-English scripts from time to time, most of them uses utf-8 charset, VIM and Gvim does not display UTF-8 Characters correctly.
在 windows 7 64 位上使用 VIM 7.3.46,在 _vimrc 中使用 set guifont=Monaco:h10
Using VIM 7.3.46 on windows 7 64 bit, with set guifont=Monaco:h10
in _vimrc
有没有办法解决这个问题?
Is there a way to fix this?
更新:我搜索了一下,发现 set guifontwide
是区域语言的第二个后备.
Update: I've googled around and found set guifontwide
acts as second fallback for regional languages.
我在 _vimrc 中添加了以下几行,我的大部分问题都得到了解决.
I added the following lines in _vimrc and most of my problems got solved.
set enc=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf8,prc
set guifont=Monaco:h11
set guifontwide=NSimsun:h12
上面的NSimsun字体适用于中文,问题是我不知道他们是如何得到与VIM一起使用的字体名称,Courier New
被提到为Courier_New
NSimsun
也没有在字体目录中.我想使用的字体是 Latha
但是,我不知道如何在 _vimrc 文件中使用它.set guifontwide=latha:h12
或 set guifontwide=Latha:h12
不起作用.
The above NSimsun font works for Chinese, The problem is I don't know how they got the font name to work with VIM, Courier New
is mentioned as Courier_New
also NSimsun
is nowhere in the font directory. The font I want to use is Latha
But, I don't know how to use it in _vimrc File. set guifontwide=latha:h12
or set guifontwide=Latha:h12
doesn't work.
如果我成功将guifontwide
设置为latha
,那么我的问题就解决了,怎么办?
If I successfully set the guifontwide
to latha
, then my problem will be solved, How to do it?
推荐答案
尝试使用以下方法重新加载文档:
Try to reload the document using:
:e! ++enc=utf8
如果可行,您可能应该更改 .vimrc 中的 fileencodings
设置.
If that works you should maybe change the fileencodings
settings in your .vimrc.
这篇关于如何在 VIM 或 Gvim 中查看 UTF-8 字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!