OSX下终端和Vim的两个小问题解决

终端不能显示中文
  在OSX的默认Terminal下用”ls”是显示不出中文的,看到的中文会是一串转义字符。
解决方法:
$ls -w

一劳永逸,编辑”etc/profile”(需要用sudo),增加一行
alias ls="ls -w"

Vim 7.0
安装
  OSX自带的是vim 6.2,所以需要到http://macvim.org下载一个7.0的版本安装。

配置
  中文环境的话打开vim会报菜单错误,需要编辑”/Applications/Vim.app/Contents/Resources/vim/gvimrc”中的第9行,去掉开头的双引号。
" finish

  编辑~/.vimrc,加入一行”set enc=utf-8″以解决菜单乱码。

Terminal下使用vim
  虽然这样通过Finder可以正常使用vim,但大部分vim用户都是习惯在Terminal中使用vim的(最起码我是这样)。编辑”/etc/profile”(需要用sudo),增加一行:
alias vim="/Applications/Vim.app/Contents/MacOS/Vim"

Technorati Tags: , ,

4 Responses to “OSX下终端和Vim的两个小问题解决”

  • rayzer says:

    terminal的vim里面输中文好使么?

  • kDolphin says:

    能正常输入,不过非utf-8编码的中文文档我还没测试过。

  • rayzer says:

    我的老是输不了
    显示”ä­é®”这样的东西
    字符集设的unicode utf-8
    还有什么要设的呢?

  • kDolphin says:

    我不知道怎么打这些字符,不过复制过去看”ä­®”正常,­é有些问题,会多一个减号出来。vim和终端都一样结果。

Leave a Reply to kDolphin

Note: Commenter is allowed to use '@User+blank' to automatically notify your reply to other commenter. e.g, if ABC is one of commenter of this post, then write '@ABC '(exclude ') will automatically send your comment to ABC. Using '@all ' to notify all previous commenters. Be sure that the value of User should exactly match with commenter's name (case sensitive).