有时候需要在服务器端修改代码,但是没有自动补全功能实在是麻烦,就学习了一下,实现了自动补全功能
一:下载php函数库
官方地址http://svn.php.NET/viewvc/phpdoc/doc-base/trunk/funclist.txt
或者在此地址下载 https://download.csdn.net/download/fei003/10326273
二:复制到家目录中一个目录中
例如:我复制到了 /root/.vim/目录中
三:在~/.vimrc中添加如下代码
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
set dictionary+=/root/.vim/php_functionlist.txt
set complete-=k complete+=k
function! InsertTabWrapper()
let col=col(‘.’)-1
if !col || getline(‘.’)[col-1] !~ ‘\k’
return “\”
else
return “\”
endif
endfunction
inoremap =InsertTabWrapper()
四:注意
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
set dictionary+=/root/.vim/php_functionlist.txt //这是php函数库路径,不要写错了,可以自己修改
set complete-=k complete+=k
function! InsertTabWrapper()
let col=col(‘.’)-1
if !col || getline(‘.’)[col-1] !~ ‘\k’
return “\”
else
return “\”
endif
endfunction
inoremap =InsertTabWrapper()