ubuntu server使用自己的vim配置时,提示Cannot set language to "zh_CN.UTF-8"错误,需要修改语言环境.

具体错误如下:

1
2
3
4
vagrant@vagrant-ubuntu-trusty-64:~/.myvim/vimrc$ sudo vim /etc/default/locale 
Error detected while processing /home/vagrant/.myvim/vimrc/first.vim:
line 14:
E197: Cannot set language to "zh_CN.UTF-8"

解决方案

  1. 修改配置
    编辑/etc/default/locale,修改为:

    1
    2
    3
    ## sudo vim /etc/default/locale
    LANG="zh_CN.UTF-8"
    LANGUAGE="zh_CN:zh"
  2. 然后执行sudo locale-gen zh_CN.UTF-8

  3. 问题解决

参考文档

  1. http://blog.csdn.net/feihong247/article/details/7767889
  2. http://blog.sina.com.cn/s/blog_62dd23ed0100qzkl.html