PhpStorm, It Eclipses VIM (for PHP)

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.

Here’s Why

Whilst VIM is a brilliant tool for any kind of text editing, whether it be Markdown, plain text, shell scripts, HTML, or anything else which is textually based; from a PHP (and JavaScript, Python, and Ruby) perspective, I’ve found it lacking – specifically when it comes to code completion.

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.

vim complete fail

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

PhpStorm - The Best PHP IDE

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.

vim-go plugin

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?

Wrapping Up

That’s my perspective – what’s yours? Do you have code completion working in PHP (or Java,JavaScript, Python or Ruby)? If so, let’s talk. I’d love to know more about your configuration. Otherwise, if you’re a PhpStorm user, what’s the most compelling features which keep you using it?


You might also be interested in these tutorials too...

Why I Created the Free the Geek Website By Hand
Sun, Nov 8, 2015

Why I Created the Free the Geek Website By Hand

With so many existing solutions for creating websites, why would you create one by hand? This post looks at the reasons why I chose to create the site by hand, versus using an established platform, such as Sculpin or Wordpress

First Experiences with Symfony 4 & the Symfony Community
Sat, Dec 30, 2017

First Experiences with Symfony 4 & the Symfony Community

Recently, I decided to learn the basics of the Symfony (4) framework, so that I could better understand one of my client’s applications, and provide better support to it. I never expected to use such a well-rounded framework. Nor did I expect to encounter such an engaged and supportive community. Here’s the story.

Becoming a Polyglot Developer (again)
Mon, Oct 10, 2016

Becoming a Polyglot Developer (again)

I’ve been developing software in PHP for a long time. But I recently decided to return to my polyglot roots, developing in multiple languages on a regular basis. The question is, which language, or languages, are the right ones to learn and use.


Want more tutorials like this?

If so, enter your email address in the field below and click subscribe.

You can unsubscribe at any time by clicking the link in the footer of the emails you'll receive. Here's my privacy policy, if you'd like to know more. I use Mailchimp to send emails. You can learn more about their privacy practices here.

Join the discussion

comments powered by Disqus