vim:PHP(またはその他の言語)エディタとして使う場合の設定メモ

※Windows上で使う場合
※php.dic(PHP関数辞書)をD:\vim\php.dic’置いた場合

まず、autocomplpop.vimをruntime/plugin に置く

以下をvimrcに記述

“タブをスペースに変換
set expandtab

“行番号表示
set number

で補完
” {{{ Autocompletion using the TAB key
” This function determines, wether we are on the start of the line text (then tab indents) or
” if we want to try autocompletion
function! InsertTabWrapper()
let col = col(‘.’) – 1
if !col || getline(‘.’)[col – 1] !~ ‘\k’
return “\<TAB>”
else
if pumvisible()
return “\<C-N>”
else
return “\<C-N>\<C-P>”
end
endif
endfunction
” Remap the tab key to select action with InsertTabWrapper
inoremap <tab> <c-r>=InsertTabWrapper()<cr>
” }}} Autocompletion using the TAB key
“Vimで括弧/クォートを自動補完

inoremap { {}<LEFT>
inoremap [ []<LEFT>
inoremap ( ()<LEFT>
inoremap ” “”<LEFT>
inoremap ‘ ”<LEFT>
vnoremap { “zdi^V{<C-R>z}<ESC>
vnoremap [ “zdi^V[<C-R>z]<ESC>
vnoremap ( “zdi^V(<C-R>z)<ESC>
vnoremap ” “zdi^V”<C-R>z^V”<ESC>
vnoremap ‘ “zdi'<C-R>z'<ESC>

“自動補完
autocmd FileType * let g:AutoComplPop_CompleteOption = ‘.,w,b,u,t,i’
autocmd FileType php let g:AutoComplPop_CompleteOption = ‘.,w,b,u,t,i,kD:\vim\php.dic’
let g:AutoComplPop_IgnoreCaseOption = 1