Andy's Blog » » vim 添加 php 函数自动完成功能

vim 添加 php 函数自动完成功能

从官方下载 funclist.txt

# wget -c http://cvs.php.net/viewvc.cgi/phpdoc/funclist.txt
# mv funclist.txt /usr/share/vim/vim70/dict/php.dict

然后

# vi /etc/vimrc

在最下面加入

"ADD BY ANDY =============================
set complete+=k "add dictionary complete
set dictionary=/usr/share/vim/vim70/dict/php.dict "set dictionary

"Auto completion 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 auto completion
function! InsertTabWrapper()
    let col=col('.')-1
    if !col || getline('.')[col-1] !~ '\k'
        return "\<TAB>"
    else
        return "\<C-N>"
    endif
endfunction

"Remap the tab key to select action with InsertTabWrapper
inoremap <TAB> <C-R>=InsertTabWrapper()<CR>

"TAB设置===============
set expandtab
"set sw=4
set et sw=4 ts=4 sts=4
set tabstop=4
set softtabstop=4

搞定

Incoming search terms:

Tags: vim, 自动完成

本文地址: http://www.21andy.com/new/20100310/1768.html

1 评论 to “PHP开源CMS之MODx”

  1. virteman 于 2010-03-10 20:42:43 发表:

    很不错,喜欢vim,她是很有内涵的编辑器。
    欢迎指点我的博客,http://virteman.webbeb.com
    顺便向你推荐一个实时访客轨迹的挂件,http://fireeye.webbeb.com/