Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 02-18-2008, 04:17 AM   #1
Registered: Oct 2003
Location: Austin,TX
Distribution: Debian SID-->fully content-->Love APT,kernel 2.6.4
Posts: 327

Rep: Reputation: 30
Vim omin-completion for PHP

I've been using Eclipse to work on my PHP projects for a while now, but have recently moved back to vim to save on system resources. I have vim setup and working exactly how I like it (with indentation, syntax highlighting, setting up tags, working with tabs etc.) except for one issue - auto (or omni) completion. I use ctags to build a tags file for the project I'm working on (I don't have access to the machine where the script is sitting at the moment - but it basically ignores everything but .php files, and does a recursive search under the folder I pass it).

I then set the tags file in vim and go to work - C-X, C-o works but it does not give me a context sensitive list of options. For example, if I have a Class called PersonBase which has a static method called retrieveByPK, typing in PersonBase::re (C-X,C-o) gives me a list of more than just the two static methods contained in the PersonBase class (this list includes some methods from the PHP library itself). It gets even worse when using omni-completion with Objects returned from a function. I get a list of all available functions which I have to browse through to get to the one I need.

I was wondering if anybody can help me out with this problem - it's not a show stopper for me, 'cause Vim brings a lot more to the table, but I would really like auto-completion to be working so that I can start being a tad more productive.
Old 05-16-2008, 10:46 AM   #2
LQ Newbie
Registered: May 2008
Posts: 1

Rep: Reputation: 0
" Assuming Vim 7 (full version) is installed,
"   adding the following to your ~/.vimrc should work.

filetype plugin on
au FileType php set omnifunc=phpcomplete#CompletePHP

" You might also find this useful
" PHP Generated Code Highlights (HTML & SQL)                                              
let php_sql_query=1                                                                                        
let php_htmlInStrings=1

" Hope this helps!


php, vim

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Cream for Vim - Making Vim more user friendly LXer Syndicated Linux News 0 06-18-2006 12:54 AM
vim php with weird extensions dlublink Linux - Software 2 12-24-2005 10:35 AM
does vim have an option for code completion? sneak Linux - Software 4 07-20-2004 08:05 AM
vim php color coding? Longinus Linux - Software 4 04-11-2004 06:56 AM
Omin 56k NetScripter Linux - General 0 02-12-2002 01:15 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:32 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration