tags:

views:

198

answers:

1

I'm using vim with php omnicompletion on in a large project. I have a ctags file and using:

au FileType python set omnifunc=pythoncomplete#Complete
au FileType php set omnifunc=phpcomplete#CompletePHP
au FileType javascript set omnifunc=javascriptcomplete#CompleteJS
au FileType html set omnifunc=htmlcomplete#CompleteTags
au FileType css set omnifunc=csscomplete#CompleteCSS
au FileType xml set omnifunc=xmlcomplete#CompleteTags

set complete=""
set complete+=.
set complete+=k
set complete+=b
set complete+=t

in my config

Currently omni complete will complete php built ins after 5+ seconds. It will not complete anything from my tags list, however <C-p> will complete items from the tags list. I had thought the complete=t would check the tags file.

Tags completion via <C-p> is very fast, so not sure what is weighing down my omni completion to be so amazingly slow.

If I edit a fresh .php file in my home dir vs this project dir the php built in omni complete is quick.

Thanks for any tips/help is debugging this. Ideally I'd like to have omni doing both built in and ctags completion together as seems to be suggested by the complete=t docs.

+1  A: 

Omnicompletion and <C-p> completion are completely independent. The complete option only affects completion via <C-p>/<C-n> and <C-x><C-l>. If you want omnicompletion to also attempt to use tags, then you would need to modify the completion function to do so.

In the case of PHP, it does consider tags but that's just one part of what it does. The reason omnicompletion is slower than the completion of tags is that it's more complex. Searching a tag file for a word that matches what's before the cursor is quite different than parsing the context of the current buffer, finding all valid types of information that could be completed there, limiting it to what matches the text before the cursor, and presenting that.

jamessan
Somehow my tags file was > 500M and C-p and omni were hitting it differently. I've gotten the tags file down to 1.5M and it definitely seems to be working much better now. I'll have to play with it some more and read up on some of the differences. Thanks
Rick