让Vim在Windows上完全支持UTF-8 [英] Have Vim fully support UTF-8 on Windows

查看:168
本文介绍了让Vim在Windows上完全支持UTF-8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用vimgVim,在虚拟Linux框中使用vim进行编程.通常,我需要更改gettext目录文件.但是,可能是由于字符集,两个Windows版本对Unicode字符的支持似乎都不完整.

I use vim and gVim on Windows, and vim in a virtual Linux box for programming. Often I need to change gettext catalog files. However, the support for Unicode characters seems to be incomplete in both Windows versions, perhaps because of the character set.

例如,变音符(äöü)可以正常工作;但印刷引号("或ˮ")以及其他一些字符(如mdash和ellipse)则没有(在Linux框中为 do ). Vim抱怨转换错误,并以只读模式打开文件.覆盖它并以任何方式存储时,这些字符将被破坏.

For example, umlauts (äöü) work just fine; but typographical quotes („" or "ˮ) and some other characters like mdash and ellipse don't (they do in the Linux box). Vim complains about conversion errors and opens the files in read-only mode; when overriding this and storing anyway, those characters are broken.

其他Windows程序也支持这些字符,例如TortoiseSVN.

Other Windows programs support those characters just fine, e.g. TortoiseSVN.

请注意,这不是错误的编码"问题,例如latin-1而不是utf-8,因为这也会影响变音符号.我知道encfencfencs:e ++enc=utf-8的设置.

Note that this is not a "wrong encodingˮ matter, like latin-1 instead of utf-8, as this would affect the umlauts as well. I'm aware of the settings enc, fenc, fencs, and of :e ++enc=utf-8.

:version告诉我:7.3版本,带有OLE支持的MS Windows 32位GUI版本,包括更正了1-46; +multi_byte_ime/dyn.

:version tells me: version 7.3, MS Windows 32 bit GUI version w/OLE support, including corrections 1-46; +multi_byte_ime/dyn.

更新:更新到Vim 7.4不能解决问题. +multi_byte_ime/dyn,并且由于现在列出的选项更加可读:+digraphs-xfontset-postscript(我不知道它们是否有意义).

Update: Updating to Vim 7.4 didn't solve the problem. +multi_byte_ime/dyn and, since the options are listed more readably now: +digraphs, -xfontset, -postscript (I don't know whether or not they are of interest).

由于我使用Linux Vim(仍然是7.3,包括更正号1-547)处理相同的文件,并且通过Samba(现在更新的Windows gVim)处理了相同的文件,因此我尝试了以下操作:我使用Linux版本打开了目录文件,该目录文件用来做有趣的报价字符好吧(:set enc? fenc?encoding=utf-8fileencoding=utf-8)并将其保存为Latin-1(:set fenc=latin-1(文件已标记为已更改),更新了标记:w).我遇到了转换错误;但是,已经进行了一些更改.

Since I work on the same files with Linux Vim (still 7.3, including corrections 1-547) and, via Samba, the now updated Windows gVim, I tried the following: I opened a catalog file with the Linux version, which used to do the funny quote chars alright (:set enc? fenc?encoding=utf-8, fileencoding=utf-8) and saved it to be Latin-1 (:set fenc=latin-1 (File is marked changed), updated the markers, :w). I got a conversion error; however, some changes had been written.

当使用相同的Linux版本重新打开文件时,我得到了正确的变音符号encoding=utf-8/fileencoding=latin-1,但是引号字符不正确.

When re-opening the file with the same Linux version, I got correct umlauts, encoding=utf-8 / fileencoding=latin-1, but incorrect quote chars.

推荐答案

阅读问题如何在VIM中查看UTF-8字符或Gvim ,我尝试了几种guifont设置(:set guifont?不产生任何结果),实际上其中一些功能带有印刷引号.

After reading the question How to view UTF-8 Characters in VIM or Gvim, I tried several guifont-settings (:set guifont? yielded nothing), and indeed some of them feature typographical quotes.

在Windows 8.1系统上,以下guifont设置对我有用:

The following guifont settings worked for me on my Windows 8.1 system:

  • Lucida_Console
  • DejaVu_Sans_Mono
  • Courier_New
  • Consolas

对于guifontwide我发现的

  • MS_Mincho

为汉字工作.

这篇关于让Vim在Windows上完全支持UTF-8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆