| 您的位置:首页 > 文档 > debian > |
文章分类热门文章 |
我的 VIM 中文设置,支持 CJK 多种文件编码和 locale 设定创建:2005-10-28 00:34:15 作者:Unlinux 来自: http://www.Unlinux.com 还是 LinuxSir 人多,我一稿多投。 拷贝以下内容到 ~/.vimrc 或 ~/.gvimrc 中即可。 " multi-encoding setting if has("multi_byte") "set bomb set fileencodings=ucs-bom,utf-8,cp936,big5,euc-jp,euc-kr,latin1 " CJK environment detection and corresponding setting if v:lang =~ "^zh_CN" " Use cp936 to support GBK, euc-cn == gb2312 set encoding=cp936 set termencoding=cp936 set fileencoding=cp936 elseif v:lang =~ "^zh_TW" " cp950, big5 or euc-tw " Are they equal to each other? set encoding=big5 set termencoding=big5 set fileencoding=big5 elseif v:lang =~ "^ko" " Copied from someone's dotfile, untested set encoding=euc-kr set termencoding=euc-kr set fileencoding=euc-kr elseif v:lang =~ "^ja_JP" " Copied from someone's dotfile, untested set encoding=euc-jp set termencoding=euc-jp set fileencoding=euc-jp endif " Detect UTF-8 locale, and replace CJK setting if needed if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" set encoding=utf-8 set termencoding=utf-8 set fileencoding=utf-8 endif else echoerr "Sorry, this version of (g)vim was not compiled with multi_byte" endif 本设定允许用户在 UTF-8 环境下阅读其它 CJK 编码的文件,反之亦然。 保存文件时所使用的编码也根据当前 locale 设置而定。 本设定部分参考了李果正兄的相关文章 http://moto.debian.org.tw/viewtopic.php?t=753 转载自:http://www.unlinux.com/doc/debian/20051028/5933.html 【评论】 【加入收藏夹】 【大 中 小】 【打印】 【关闭】 ※ 相关链接
|