windows下 gvim 配置
配置文件为
" autoload _vimrc
autocmd! bufwritepost _vimrc source %
" disable VI's compatible mode
set nocompatible
set fileencodings=ucs-bom,utf-8,chinese
set fileencoding=utf-8
" use chinese help
set helplang=cn
if has("gui_running")
set guifont=Yahei_Mono:h11:cGB2312
colorscheme oceandeep
endif
" Enable syntax highlight
syntax enable
" Show line number
set nu
" show matching bracets
set showmatch
" Basic editing options
set expandtab
set shiftwidth=2
au FileType html,python,vim,javascript setl shiftwidth=2
au FileType html,python,vim,javascript setl tabstop=2
au FileType java,php setl shiftwidth=2
au FileType java,php setl tabstop=2
set smarttab
set lbr
set tw=0
"Auto indent
set ai
" Smart indet
set si
" C-style indeting
set cindent
"Wrap lines
set wrap
" Sets how many lines of history VIM har to remember
set history=400
" Set to auto read when a file is changed from the outside
set autoread
" Have the mouse enabled all the time:
set mouse=a
" Do not redraw, when running macros.. lazyredraw
set lz
" set 7 lines to the curors - when moving vertical..
set so=7
" The commandbar is 2 high
set cmdheight=2
" Change buffer - without saving
set hid
" Ignore case when searching
" set ignorecase
set incsearch
" Set magic on
set magic
" No sound on errors.
set noerrorbells
set novisualbell
set t_vb=
" How many tenths of a second to blink
set mat=4
" Highlight search things
set hlsearch
" Turn backup off
set nobackup
set nowb
set noswapfile
" smart backspace
set backspace=start,indent,eol
" switch buffers with Tab
map <C-Tab> :bn<CR>
map <S-Tab> :bp<CR>
" NERDTree
let NERDTreeBookmarksFile='d:\Vim\vimfiles\bookmarks.txt'
let NERDTreeShowLineNumbers=1
let NERDChristmasTree=1
let NERDTreeAutoCenter=1
let NERDTreeShowBookmarks=0
let NERDTreeWinPos='left'
let NERDTreeChDirMode=1
let NERDTreeStatusline = 1
let NERDTreeChDirMode = 1
map <C-t> :NERDTreeToggle <C-R>=""<CR>
map <C-g> :cs find g <C-R>=expand("<cword>")<CR>
" taglist
let Tlist_Auto_Highlight_Tag = 1
let Tlist_Auto_Open = 1
let Tlist_Auto_Update = 1
let Tlist_Close_On_Select = 0
let Tlist_Compact_Format = 0
let Tlist_Display_Prototype = 0
let Tlist_File_Fold_Auto_Close = 0
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Hightlight_Tag_On_BufEnter = 1
let Tlist_Inc_Winwidth = 0
let Tlist_Max_Submenu_Items = 1
let Tlist_Max_Tag_Length = 30
let Tlist_Process_File_Always = 0
let Tlist_Show_Menu = 0
let Tlist_Show_One_File = 1
let Tlist_Sort_Type = "order"
let Tlist_Use_Horiz_Window = 0
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 40
let Tlist_Exit_OnlyWindow = 1
let Tlist_Ctags_Cmd='D:\Vim\vim73\ctags.exe'
map <C-f> :TlistToggle<CR>
"bufexplorer
let g:bufExplorerDefaultHelp=1
let g:bufExplorerDetailedHelp=0
let g:bufExplorerSortBy='mru'
nmap <C-X> :BufExplorer<CR>
" php editing
" remove CR at end of lines
let PHP_removeCRwhenUnix = 1
" Set up automatic formatting
set formatoptions+=tcqlro
" Set maximum text width (for wrapping)
set textwidth=110
" NERD Commenter
let NERDShutUp = 1
filetype plugin on
"为指定后缀的文件指定字典文件
autocmd FileType php set dictionary=D:\Vim\vimfiles\php.txt
autocmd FileType python set dictionary=D:\Vim\vimfiles\python-complete-dict
autocmd FileType python set dictionary=D:\Vim\vimfiles\html.txt
"为指定后缀的文件指定模板文件
"au FileType python set ft=python.django
"au FileType html set ft=htmldjango.html
set complete-=k complete+=k
set runtimepath+=D:\Vim\vimfiles\vim-php-manual
au BufNewFile,Bufread *.module,*.inc,*.php,*.install,*.test set keywordprg="help"
au BufNewFile,BufRead *.install,*.inc,*.module,*.test set filetype=php
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>
:inoremap ' ''<ESC>i
:inoremap " ""<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
"取消高亮
set nohls
"窗口最大化
au GUIEnter * simalt ~x
set guioptions-=m
set guioptions-=T
set guioptions-=r
set guioptions-=b
set guioptions-=l
"dir /s /b *.php > cscope.files
"cscope -b
"jj退出编辑状态 默认是按Esc 这个不方便
imap jj <Esc>
let g:SuperTabMappingForward="<tab>"
主要配置
1, 安装supertab插件 按tab自动补全 默认是 ctrl+n /ctrl+p
2,http://www.vim.org/scripts/script.php?script_id=2540 snipMate 快速模板编程
3,解决 supertab 和 snipMate tab键冲突 有snipMate模板匹配执行snipMate 否则 执行tab自动补全
就是 let g:SuperTabMappingForward="<tab>" 这个配置
4,php python 基于字典文件的自动完成
利用 http://vim.sourceforge.net/scripts/script.php?script_id=850
这个插件下载后只用于生成python字典文件 不安装这个插件 python字典生成方法
需要我配置好的压缩包的同学 可以发邮件给我 quqiufeng@gmail.com

浙公网安备 33010602011771号