原文:http://lizhuang.iteye.com/blog/435388

将安装目录的_vimrc文件替换为以下代码即可:

  1. set nocompatible  
  2. source $VIMRUNTIME/vimrc_example.vim  
  3. source $VIMRUNTIME/mswin.vim  
  4. behave mswin  
  5.   
  6. set diffexpr=MyDiff()  
  7. function MyDiff()  
  8.   let opt = '-a --binary '  
  9.   if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif  
  10.   if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif  
  11.   let arg1 = v:fname_in  
  12.   if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif  
  13.   let arg2 = v:fname_new  
  14.   if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif  
  15.   let arg3 = v:fname_out  
  16.   if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif  
  17.   let eq = ''  
  18.   if $VIMRUNTIME =~ ' '  
  19.     if &sh =~ '\<cmd'  
  20.       let cmd = '""' . $VIMRUNTIME . '\diff"'  
  21.       let eq = '"'  
  22.     else  
  23.       let cmd = substitute($VIMRUNTIME, ' ''" ''') . '\diff"'  
  24.     endif  
  25.   else  
  26.     let cmd = $VIMRUNTIME . '\diff'  
  27.   endif  
  28.   silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq  
  29. endfunction  
  30.   
  31. """""""""""""""""""""""""""""  
  32. "解决windows下的中文乱码问题  
  33. """""""""""""""""""""""""""""  
  34. set encoding=utf-8  
  35. "set termencoding=utf-8  
  36. set fileencodings=ucs-bom,utf-8,chinese,latin-1  
  37. if has("win32")  
  38. set fileencoding=chinese  
  39. else  
  40. set fileencoding=utf-8  
  41. endif  
  42. "解决中文菜单乱码  
  43. set langmenu=zh_CN.utf-8  
  44. source $VIMRUNTIME/delmenu.vim  
  45. source $VIMRUNTIME/menu.vim  
  46. "解决console输出乱码  
  47. language messages zh_cn.utf-8 
posted on 2011-10-11 16:44  hotty  阅读(370)  评论(0)    收藏  举报