我的VIM配置
把配置帖出来,以防下次找不到了,加上注释。
"=============开始=========================
"不兼容模式
set nocompatible
"自带的
source $VIMRUNTIME/mswin.vim
behave mswin
"命令行高
set ch=1
"鼠标隐藏
set mousehide
"模板插件的模板文件目录
let g:template_path = 'D:\Program Files\Vim\vim73\templates\'
" Make shift-insert work like in Xterm
map
map!
"不保存备份
set nobackup
setlocal noswapfile
set bufhidden=hide
set shortmess=atI
"历史记录
set history=200
"文件类型载入,高亮,缩进
filetype on
filetype plugin on
filetype indent on
"高亮文件
syntax on
"据说是100列之后的高亮
:highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white
:match OverLength '\%101v.*'
"普通文本的高亮,需要txt.vim
au BufRead,BufNewFile * setfiletype txt
"据说是php内的html模式
nnoremap 1 :set filetype=xhtml
nnoremap 2 :set filetype=css
nnoremap 3 :set filetype=javascript
nnoremap 4 :set filetype=php
"编码
set encoding=UTF-8
set langmenu=zh_CN.UTF-8
"菜单乱码,所以加上这两行
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language message zh_CN.UTF-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
"保存窗口尺寸(好像没用,不知道是不是我弄错了,有大虾指教下^_^)
set sessionoptions+=resize
"配色
colorscheme lucius
"隐藏工具栏
set guioptions-=T
"隐藏菜单的,暂时不要
"set guioptions-=m
" 缩进的设置
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
set softtabstop=4
set shiftwidth=4
set noexpandtab
set formatoptions=tcrqn
set autoindent
set smartindent
set cindent
set smarttab
"折叠代码
set foldenable
set foldmethod=syntax
set foldcolumn=0
setlocal foldlevel=1
"backspace
set backspace=2
set whichwrap+=<,>,h,l
"行号
set number
"名称排序
let Tlist_Sort_Type = "name"
"状态栏
set laststatus=2
highlight StatusLine guifg=SlateBlue guibg=White
highlight StatusLineNC guifg=Gray guibg=White
set statusline=[%n]%<%f%y%h%m%r%=[%b\ 0x%B]\ %l\ of\ %L,%c%V\ Page\ %N\ %P
"
set wildmenu
" 自动完成
:inoremap ( ()i
:inoremap ) =ClosePair(')')
:inoremap { {}i
:inoremap } =ClosePair('}')
:inoremap [ []i
:inoremap ] =ClosePair(']')
:inoremap < <>i
:inoremap > =ClosePair('>')
"显示匹配的括号
set showmatch
set matchtime=2
"
let b:javascript_fold=1
"js的dom支持.
let javascript_enable_domhtmlcss=1
"几个语言的字典文件,暂时还没下载到字典文件
"autocmd filetype javascript set dictionary=$VIMFILES/dict/javascript.dict
"autocmd filetype css set dictionary=$VIMFILES/dict/css.dict
"autocmd filetype php set dictionary=$VIMFILES/dict/php.dict
"字体和其它
if has("win32")
set guifont=Courier_New:h11:cANSI
set mouse=a
set selection=exclusive
set selectmode=mouse,key
endif
"应该是命令行模式的东西,我安装的时候带的,就全放过来了
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 =~ '\
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