Setting up PHP completion in Vim
Yesterday I setup PHP completion in Vim by adding the following to my
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
Here's a quick breakdown of what each line does:
First we setup omnicomplete for PHP, which will let us trigger the completion
Then we improve the way the way completion is handled.
longest makes Vim only
autocomplete up to the "longest" string that all the completions have in common
menuone makes the menu spawn even if there is only one result.
Next, triggering completion with
Ctrl+x,Ctrl+o is rather cumbersome, so
I also installed SuperTab via Vundle which triggers all the
completion commands (including Ultisnips) via tab, while still letting it
be used for indenting.
Finally, I was able to have the completion menu include the function's signatures (argument and return types) by installing the phpcomplete.vim plugin.