2011年(6)
分类: LINUX
2011-08-15 16:46:59
vim中文问题真是很烦人,google了一圈都没有真正能解决的办法,后来一次无意间在一篇博客中看到这种方法,确实很奏效
查看configure --help:
...
--enable-workshop Include Sun Visual Workshop support.
--disable-netbeans Disable NetBeans integration support.
--enable-sniff Include Sniff interface.
--enable-multibyte Include multibyte editing support.
--enable-hangulinput Include Hangul input support.
--enable-xim Include XIM input support.
--enable-fontset Include X fontset output support.
...
选项有很多,但中间加黑的那一项,就是它了!多字节编辑支持,重新编译一次
$./configure --enable-multibyte
$ make && sudo make install
查看安装后的版本信息
[root@localhost vim73]# vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jan 11 2011 16:17:51)
编译者
正常版本 无图形界面。 可使用(+)与不可使用(-)的功能:
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec +mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile -python
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
系统 vimrc 文件: "$VIM/vimrc"
用户 vimrc 文件: "$HOME/.vimrc"
用户 exrc 文件: "$HOME/.exrc"
$VIM 预设值: "/usr/local/share/vim"
可以清楚的看到,已经支持多字节。尝试打开含有中文的文件,一切正常。