Over the last few days of Symfony 2 training, my vim-ing has endured a severe whipping from the likes of NetBeans and other full-fledged IDE’s. It didn’t help that the trainer was doing all his code examples in NetBeans. I shuddered everytime we did a
use statement. Symfony 2 takes full advantage of the PHP 5.3 namespace feature, so with all the classes organized hierarchically, the average class ends up being about 5 levels deep.
So last night, I thought I’d try out NetBeans to see if I could use it. To my delight, there was also a plugin called jVi that allows me to use vim keybindings. After 10 minutes of messing around, I just couldn’t do it.
Traversing the project tree required reaching for the mouse. jVi refused to work because of some bug in NetBeans 7.1, and the line-number fonts were hardcoded ugly. Finally, as I was doing a lot of my work on a virtual machine over a samba share, NetBeans was struggling to index all the files for auto-completion and class/method name lookups.
Fine, I thought, surely there must be something I could use in vim.
After poking around a little, I discovered exuberant-ctags + FuzzyFinder + SuperTab.
Broadly speaking, this is how it works.
1. You run something like
ctags --recurse --h *.php in the root of your project.
ctags scans all your *.php files and generates a file in the root of your project tree called
2. When you use the
:FufTag command in vim (provided by FuzzyFinder), it uses the generated
tags to find a class or method definitions that match your query.
3. When you type
ctrl-] (also by FuzzyFinder) with your text cursor on a class or method name, you’re able to jump straight the definition of that class or method.
4. Finally, with SuperTab enabled, you can hit
tab while you’re coding, and it will pull up auto-complete options based on the
tags file generated by
Can’t wait to try it out at work today.