PhpStorm, It Eclipses VIM (for PHP)
Can VIM, the venerable UNIX editor, replace the modern day PHP IDE PhpStorm? The answer is no, it can't.
If you’ve been reading my blog, you’ll know that I’ve become more than a bit of a VIM
evangelist nut over recent months. I’ve been espousing the virtues of using it to any, and all, who’ll listen (even if they really don’t want to).
With dedicated effort, to the near exclusion of all other editors and tools, I’ve bridged the initial learning curve required to learn VIM essentials, and have come out the other side a much more productive writer and developer.
Note: I’m eternally indebted to Drew Neil for his book Practical VIM. If you want to learn VIM – buy the book. You won’t be disappointed.
As a result of that enthusiasm, in several recent posts, I’ve been discussing whether it could, in addition to being my writing editor, ever be my coding editor, for my language of choice, PHP. Well, after quite some effort, experimentation, trial and error, the answer is a resounding NO.
It performs just as well as any other editor for syntax highlighting, indenting, auto-brace completion, linting, and so on – but code completion’s never worked, properly.
I tried a range of plugins, including You Complete Me, SuperTab, OmniCompletion, and phpcomplete. But despite what the repositories said, all I ever managed was completion which listed nearly every symbol available. There was no context. You can see an example in the screenshot below.
But I wasn’t going to be deterred – I’m a hacker from way back. Hey, I had a Linux-only desktop for 10 years and compiled my own wireless drivers baby! This wasn’t going to beat me – or so I thought.
I read through a host of projects which claimed to have VIM providing code completion for functions, properties, variable names and other symbols. But despite much much effort, I’ve never been able to replicate these setups.
PhpStorm – Ready Out of the Box
Now contrast this with an out-of-the-box PhpStorm installation. With no extra effort, the following functionality’s on offer (amongst a host of other things):
- Code intent analysis (think unused use statements and variables, and unreachable return statements and code blocks)
- Intelligent code completion
- PHPDoc support
- Refactoring support
- Intelligent code analysis and navigation
- Namespace support
- Code formatting
- Remote debugging
What developer in their right mind wants to be without all of this, and for so little effort?
Now I could, potentially, with time, configure VIM to do all of this. But if current experience is anything to go by, it’s going to take a lot of work to accomplish it.
So the question is, when there’s a tool, dedicated to the specific domain problem I’m focused on, getting ever better with each release, with an active release cycle, which has great support – is it worth attempting to reinvent the wheel?
So far, for me, it’s a resounding no.
But It’s Not a Complete No…
OK, I’ve been a bit deceitful; for day to day coding, PhpStorm is what I use. But for the screencasts I’m increasingly making however, VIM’s perfect. I can focus the video on the code and nothing else, ensuring that the viewer isn’t distracted; as in the example below.
I don’t need a large host of features, especially not code completion, which would take away from what was being taught. I can write and navigate code quickly, and hassle free. For videos, and other training, don’t expect to see me ever use anything else.
VIM, for training, is the best tool going – period. But for active development, I don’t feel the same way. I’ve talked this over with a number of people and here’s what comes back:
If you are working on a code base which you know, then VIM’s fine. But if you are starting with a new one, one which is written different to how you would normally write; one which is overly complex (or complicated); one quite large and monolithic (read: badly written), then PhpStorm or another IDE of similar functionality is a better choice to get you up to speed quickly.
It’s not been an easy decision to come to. I really wanted to have VIM come out the victor. But it just didn’t happen. And let’s be pragmatic, I’ve paid for PhpStorm, and could really find nothing wrong with it.
OK it’s a Java, not native, application, so it doesn’t render as smoothly as other applications do. But if that’s my only gripe, then it’s not a serious one.
It is immensely configurable, and even has a VIM plugin, called IdeaVIM. Using it, I don’t have to learn two sets of muscle memory for coding. I can, almost, make no changes when coding in either PhpStorm or VIM.
VIM Could Still Win
Here’s the thing though, I think, if I or someone else were enthusiastic enough, it might easily be turned around. I say this because I when I’m coding in Go, I don’t use anything else but VIM.
But Go has some excellent tooling available, tools which include gofmt, and the wonderful gocode. It’s these tools which the vim-go package uses to transparently provide all the IDE-like functionality most of us have come to expect. If PHP had that, I don’t see why I couldn’t get over the final hurdle preventing me from using VIM with PHP.
But finally, when there’s such a dedicated, professional, and polished application, like PhpStorm, why use anything else – that includes Eclipse and Netbeans people?
Don’t miss my next post. Drop your email in the box below, and get it straight to your inbox, PLUS exclusive content only available by email. No spam, and you can unsubscribe at any time.