日期:2014-05-17  浏览次数:20668 次

Windows下vim配置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim: windows config(c:\Program Files\Vim\_vimrc)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""  
" Use Vim defaults (much better!)  
" This should the priority setting, otherwise problems can appear  
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""  
set nocompatible      
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 编码设置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fileencodings=utf-8,gb2312,gbk,gb18030  
set termencoding=utf-8  
"set fileformats=unix  
set fileformat=unix  
set encoding=prc  
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

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


set number		                " 显示行号
set tabstop=4    	            " 设定tab长度为4
set shiftwidth=4 	            " 缩进的空格数
set expandtab    	            " 是否在缩进和遇到Tab键时使用空格代替;
    			                " 使用noexpandtab取消设置
set autoindent   	            " 自动缩进
set smartindent
set cindent     

set showmatch                   " 显示括号配对情况
set paste                       " 支持外部复制(好像不管用)
set clipboard+=unnamed          " 与windows共享剪贴板

set history=50                  " keep 50 lines of command history
set scrolloff=3                 " 光标移动到buffer的顶部和底部时保持3行距离
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" color set
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
colorscheme desert	            " windows下深色主题

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" windows下gui去掉显示,如果需要显示,只需要将-改为+即可
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set guioptions-=T               " windows下隐藏工具栏
set guioptions-=r               " 把gui右边的滑动条去掉
set guioptions-=L               " 把gui左边的滑动条去掉
set guioptions-=m               " 把gui的菜单栏去掉
set shortmess=atI               " 启动的时候不显示援助索马里儿童的提示(是I而不是L)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" windows下启动vim最大化
autocmd GUIEnter * simalt ~x

set gcr=a:block-blinkon0        " windows下去掉光标闪动

set nobackup                    " 关闭自动备份功能,backup自动备份



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" windows下python配置
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 自动补全:
" 配置说明
" 1. 下载pydiction, pydiction包括了complete-dict和python_pydiction.vim
" 2. cp complete-dict to C:\Program Files\Vim\vimfiles\ftplugin\pydiction
"    cp python_pydiction to C:\Program Files\Vim\vimfiles\ftplugin
" 3. modify _vimrc