Can VIM Ever Replace PHPStorm?

Can VIM Ever Replace PHPStorm?

Is it reasonable, even practical, to expect that a 30 year old application can match a modern one?

Is it reasonable, even practical, to expect that a 30 year old application can match a modern one? Is it conceivable to be able to code as well using VIM, said 30 year old application, as I can in PhpStorm, with all the IntelliSense-lead functionality PhpStorm offers?

So here’s the story; over recent months I’ve been becoming ever more of a VIM evangelist. It’s the tool I use for all of my writing work. It’s AMAZING! No, it’s not the easiest of tools to start with, but it’s brilliant.

Others, such as Writer, MacDown, Mou, TextEdit, and so on are far easier to start with; especially if you’re not a geek, and don’t come from a technical background.

But if you stick with VIM, even just for a month as Drew Neil, author of Practical Vim suggests, (and have some help customising your setup), you rapidly learn it’s an editor which’s not only on par with the best around, it outclasses them.

I’m still learning, I won’t lie, but there’s almost nothing which I can’t do, or configure to do, if I need to. Here’s some examples:

  • I can move anywhere in a document using simple searches
  • I can replace anything using either simple searches, or more sophisticated regular expressions
  • I can jump to almost any point, whether by line number, text pattern, number of paragraphs, you name it
  • I don’t need a distraction free mode, because there’s next to nothing to distract me in the first place.

But What – There’s More!

vim with multiple splits small

Take a look at the screenshot above. There you can see 4 splits, or panes (or tabs). Each has a Markdown document which I was editing recently. I can rearrange these, resize them, skip between them as needed.

You can see that the bottom right split has the contents folded, so that you only see the active section you’re working on. This way, you can work on a large document, as though it was a small one, or flit between a series of files, with very little effort. Whilst I’m not saying I do this all the time, you get an idea of just how powerful VIM is.

I can customise it based around nearly any condition imaginable; but the primary ones are file type, which work just well, and are what we commonly do with modern, desktop, computing anyway. I could rave about it all day long, and over the coming months will be.

Given this enthusiasm, I began to create my own VIM configuration, based off of configurations from two friends, Tom Oram , and Evan Coury; and also with a little bit of inspiration from Laracast’s Jeffrey Way.

But Can I Code With It?

After some cautious experimentation and success using it, writing documents for my clients, naturally, as a developer, I began to consider using it to code with as well. Sadly, so far, that’s where things have started to break down.

Whilst I can move around in code, just as easily as I can with text, and whilst I can manage multiple documents at a time, something I’ve yet to see any other program match, one of the key aids I’m more than used to when developing software, the technology commonly referred to as IntelliSense, I’ve never been able to get it to work – not even close.

I’ve tried a multitude of options and configurations, including Omnicomplete, You Complete Me, and SuperTab. I’ve tried working with exuberant ctags. I’ve tried phpcomplete.

vim autocomplete fail

Whilst similar in appearance to the ultra-powerful implementation which I use daily in PhpStorm, instead of getting relevant, contextual, matches, I get a list of every variable, function, class, and more, which you can see above, as I was trying to edit a Zend Framework 2 project.

It seems that nothing is able to know, properly, your current context and provide a set of relevant options to match it. I’ve asked around quite a lot about what to do, but the feeling is not really positive about the chances of me being successful in replicating, or near replicating the functionality of PhpStorm.

Some say that it’s likely impossible.

Others say that it’s probably really hard to do it.

And still others suggest that the original creator of VIM doesn’t want VIM to be an IDE anyway.

So at this point, I’ve not pursued it further. Hey, I paid for PhpStorm, so really should use it, and I’m not going to decry it – it’s an excellent tool. For a Java GUI application, it’s amazingly fast. No, really! It does so much, so quickly, and is so good at it. The only aspect which is slow, by comparison, is the indexing.

But that’s relative, based on the amount of files required to be indexed. So you’d expect it to vary. So, for the time being, I’m continuing with PhpStorm as my main editor of choice.

Despite having PHP in the name, it does remarkably well as a cross-language IDE, wherein I can easily code in my main languages of PHP, JavaScript/Node.js, Ruby, and Go.

But the thing is, I’ve been so happy, and become so proficient, with VIM, that I’d love to parlay that in to development too; even if for no other reason than the street cred.

Ok, perhaps street cred’s a bit much, given the effort required to be invested. Though I have been told about Neovim, which, whilst not ready yet, may be an answer to the issue.

But as said, it’s not ready yet. So am I just being pedantic? I have been using the IdeaVIM plugin in PhpStorm, and whilst not replicating all VIM’s functionality, it does an excellent job of what it does implement. I’d not edit any other way.

Is IntelliSense The Right Approach?

This leads me to the question above, one I’ve been considering more and more. Is attempting to replicate IntelliSense the wrong approach? Is IntelliSense really the most effective approach to development productivity in the first place? Consider this screenshot from the vim-go plugin. Here, you see three splits, or panes.

vim-go plugin

In the top left, is the code currently being edited. On the right is the list of symbols related to the current code, including variables, methods, and so on. And in the bottom split is the definition of the current symbol under the cursor.

By having all of this active, do you really need to have a pop-up prompting you. OK, sure, having functionality be prompted and with a tab, completed for you, over time, can save you a lot of typing. Agreed.

But is it the best approach to take? Is there another approach which is, whilst at first seemingly not either obvious nor logical, actually either just as, if not more, effective? Having suggested this, I don’t have an answer, so I’m leading you, potentially, to a dead end.

But it’s a question I’ve not been able shake. I’ve not started investigating it yet, whether on IRC, or in forums, but I’m thinking there may be something in it. Anyway, I don’t want to go on at length about it.

Wrapping Up

For the time being, I’m perfectly happy using PhpStorm as my IDE, for just about any and every language. It’s powerful, comes at a reasonable price, and so many other people I know and respect, people far more experienced and knowledgeable than I use it.

Perhaps I’m just intransigent, or am desperate for “nerd cool”, that I can’t let it go. But there’s an insatiable desire to be able to full-time code with VIM as well as write with it.

If you’re a long time VIM user, even a VIM hacker, I’d love to know what you think and to get your input. Am I being unrealistic in my expectations?

Is my latter thought the right one? Which way do you suggest I go?

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

Vim - The Distraction Free Editor
Thu, Jul 20, 2017

Vim - The Distraction Free Editor

A little while ago, I took to Twitter in a sense of jubilant excitement announcing that VIM was THE distraction-free editor. As it’s been quite some time since, I honestly don’t remember exactly what it was that motivated me to do so.

Setup Step Debugging in PHP with Xdebug 3 and Docker Compose
Wed, Mar 10, 2021

Setup Step Debugging in PHP with Xdebug 3 and Docker Compose

In versions of Xdebug before version 3 setting up step debugging for code inside Docker containers has often been challenging to say the least. However, in version 3 it’s become almost trivial. In this short tutorial, I’ll step you through what you need to do, regardless of the (supported) text editor or IDE you’re using.

How to Run Tests in PhpStorm
Fri, Jan 3, 2020

How to Run Tests in PhpStorm

PhpStorm offers so much functionality. From syntax highlighting to Docker integration, it’s an extremely comprehensive tool. However, have you ever thought of using it to run your unit tests? In this article, I step you through running tests, from an entire suite to an individual test.

How to Set Up PHP Debugging with PhpStorm, Xdebug, and PHPUnit
Sun, Nov 3, 2019

How to Set Up PHP Debugging with PhpStorm, Xdebug, and PHPUnit

Still using var_dump to debug your PHP code? Stop! While var_dump can be convenient, it’s a very blunt approach. In this article, I’ll show you how to set up proper debugging with PhpStorm, Xdebug, and PHPUnit, and give you a modern, sophisticated debugging experience.

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