【问题标题】:Vim using the wrong spell file?Vim 使用了错误的拼写文件?
【发布时间】:2012-02-07 16:01:02
【问题描述】:

我用vim很久了,最近建了个新服务器,打开vim发现没有使用我的spell文件。

从历史上看,vim 会加载 ~/.vim/spell/en.utf-8.add 作为拼写文件,但是当我尝试将单词添加到字典时,它会将其添加到 en.latin1.add

ls ~/.vim/spell
en.latin1.add  en.latin1.add.spl  en.utf-8.add

因此,作为一种可能的解决方法,我将set spelllang=en.utf-8 放入我的 vimrc 中。但是,它没有尝试使用en.utf-8.add,而是使用了en.utf-8.latin1.add。如何将 latin1 转换为 utf-8?

另外,这里是我的环境变量:

declare -x LANG="en_US.UTF-8"
declare -x LC_ADDRESS="en_US.UTF-8"
declare -x LC_ALL=""
declare -x LC_COLLATE="C"
declare -x LC_CTYPE="en_US.UTF-8"
declare -x LC_IDENTIFICATION="en_US.UTF-8"
declare -x LC_MEASUREMENT="en_US.UTF-8"
declare -x LC_MESSAGES="en_US.UTF-8"
declare -x LC_MONETARY="en_US.UTF-8"
declare -x LC_NAME="en_US.UTF-8"
declare -x LC_NUMERIC="en_US.UTF-8"
declare -x LC_PAPER="en_US.UTF-8"
declare -x LC_TELEPHONE="en_US.UTF-8"
declare -x LC_TIME="en_US.UTF-8"

【问题讨论】:

    标签: vim spell-checking


    【解决方案1】:

    来自文档 (:help spell-load):

    Vim searches for spell files in the "spell" subdirectory of the directories in
    'runtimepath'.  The name is: LL.EEE.spl, where:
        LL  the language name
        EEE the value of 'encoding'
    ...
    ...
    ...
    Exceptions:
    - Vim uses "latin1" when 'encoding' is "iso-8859-15".  The euro sign doesn't
      matter for spelling.
    

    尽管您的环境变量都列出了 UTF-8,但看起来 Vim 的 encoding 设置为“latin1”或“iso-8859-15”。也许你可以通过运行:set encoding=utf-8 手动设置 Vim 的编码。

    【讨论】:

    • 遗憾的是,更改编码仍然不能解决问题。
    猜你喜欢
    • 1970-01-01
    • 2011-07-29
    • 1970-01-01
    • 1970-01-01
    • 2011-07-15
    • 2013-10-05
    • 2014-12-29
    • 2010-12-14
    • 1970-01-01
    相关资源
    最近更新 更多