Have Vim fully support UTF-8 on Windows

后端 未结 2 1042
慢半拍i
慢半拍i 2021-01-01 04:46

I use vim and gVim on Windows, and vim in a virtual Linux box for programming. Often I need to change gettext catalog fi

相关标签:
2条回答
  • 2021-01-01 05:26

    The only way I have been able to consistently change file-encoding to UTF-8 on windows is by using notepad++ or powershell (see below). Regardless of the VIM version changing the file encoding from within VIM is gives inconsistent results at best.

    Once the file has UTF-8 encoding set outside of vim there are no further issues. File encoding set through vim on linux or mac are respected by windows.

    In this thread of powershell command is suggested to change the encoding. That is the fastest way I know of to set a project to UTF-8 on windowws and work without further hassle.

    In your examples above, not that there is a difference between :set encoding=utf-8 (which is temporary and only in your display) and set fileencoding=utf-8 which will change the file on save.

    0 讨论(0)
  • 2021-01-01 05:37

    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.

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

    • Lucida_Console
    • DejaVu_Sans_Mono
    • Courier_New
    • Consolas

    For guifontwide I found

    • MS_Mincho

    to work for chinese characters.

    0 讨论(0)
提交回复
热议问题