GVIM 配置

"關閉兼容模式
set nocompatible
"模仿快捷鍵,如:Ctrl+A 全選、Ctrl+C複製、Ctrl+V粘貼等等·
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
"gvim字體設置
set guifont=新宋體:h18:cGB2312
"gvim內部編碼
set encoding=utf-8
"當前編輯的文件編碼
set fileencoding=utf-8
"gvim打開支持編碼的文件
set fileencodings=ucs-bom,utf-8,gbk,cp936,gb2312,big5,euc-jp,euc-kr,latinl
"set langmenu=zh_CN
"let $LANG='zh_CN.UTF-8'
"解決consle輸出亂碼
language messages zh_CN.utf-8
"解決菜單亂碼
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"設置終端編碼爲gvim內部編碼encoding
let &termencoding=&encoding
"防止特殊符號沒法正常顯示
set ambiwidth=double
"縮進尺寸爲4個空格
set sw=4
"tab寬度爲4個字符串
set ts=4
"編輯時將全部tab替換爲空格
set et
"按一次backspace就刪除4個空格
set smarttab
"不生成備份文件,如~index.html
set nobackup
"開啓行號標記
set number
"配色方案爲desert
colo desert
"關閉上側工具欄
set guioptions-=T
"關閉右側滾動條
"set guioptions-=r
"開啓自動縮進
set autoindent


set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
相關文章
相關標籤/搜索