喜欢用 VIM 快一年了,这里把自己喜欢的配置分享出来,也免得我每次安装,都要复制配置文件。
这是我 Win7 下 gVim 的配置,Linux下略有区别。
:colorscheme elflord
set nocompatible
"set guioptions-=m
set mouse=a
set guioptions-=T
"set lines=50 columns=150
set number
set numberwidth=6
set autoindent
set smartindent
set cindent
set cmdheight=2
set shiftwidth=8
set tabstop=8
set softtabstop=8
set expandtab
set smarttab
"set cursorline
"set cursorcolumn
set guifont=Consolas:h14
"set guifontwide=
set ruler
set showcmd
set showmode
"set encoding=utf-8
"set fileencoding=utf-8
"set fileencodings=utf-8
"set termencoding=utf-8
"set ambiwidth=double
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
可以在这里下载,去掉扩展名即可用于 gVim 。
/Files/coreBugZJ/_vimrc.txt