Once upon a time, PhpStorm was the IDE I loved. I thought I would use it all my life, happily without looking at any other editor.
I was wrong.
I discovered the true love of my live, called Vim.
Are you confused? Are you yelling “why” to the deaf sky? What happened between PhpStorm and me? Why a PHP developer would use this… old smelly thing called Vim?
I was happy with PhpStorm. We had a productive relationship. Its basic rules was simple, as simple as many text editor in the computing world. You use a mouse, you click where you want to change or add something, somewhere. The basic editor. We are all used to that from the beginning of times!
I loved the auto completion with PhpStorm! I loved the fact that you could find easily a peculiar file even within a massive codebase. I loved its stability. I liked the snippets. I loved its numerous options to refactor, generate getter / properties / methods using one or two handy shortcuts.
And now, I don’t use it anymore.
Firstly, I want to tell you my story with Vim and PhpStorm in order for you to understand how you can switch between the two.
Then I will compare the two and underline what Vim brings on the table.
Vim: the Hate before the Love
It was a newcomer who first showed me Vim.
He was a PHP developer hired in the company I was working for. I was curious, I began to look what tools and IDE he was using, expecting seeing the good old PhpStorm, like every good PHP developer who suffered too much with Eclipse.
“I don’t use PhpStorm” said the newcomer. “Vim is way better!”.
Vim! This dinosaur! This boring terminal editor! So complex nobody knows how to use it, except the perfect nerd without life / girlfriend / whatever real things! How can he compares the wonderful shiny PhpStorm with this relic?
At that point, I went in a crusade. I tried to show him how a good IDE with tons of features could suit his needs even better than this… Vim thing! Without success, I let him swimming in his ocean of mistakes, sad he couldn’t see the Truth as I was.
Time past. Days became years. Years became centuries. I began to understand that this newcomer was a very interested and knowledgeable developer. It astonished me. How can he be that good and use Vim?
Quickly we began to work on the same project: a tandem was born.
The Time of Mockeries
I mocked my work tandem. A lot. He was persisting in his mistake to use Vim and I couldn’t do anything to dissuade him.
I mocked the austerity of Vim’s interface. I mocked the fact that he had to configure everything in config files. I mocked that this configuration (in my opinion) was always broken. Who wants to code with a broken IDE? It was pure nonsense.
With hindsight, I may have been a bit jealous. He mastered a tool full of shortcuts in order to use the mouse as less as he can, and, without knowing it, I envied him. I envied him because I didn’t feel capable to learn how to use Vim in a reasonable amount of time.
More and more, my contempt toward Vim let place to curiosity.
PhpStorm and Me: the Breakdown
My attraction and curiosity toward Vim kept growing and growing.
The hate became love when I decided two things:
- Quitting the company I was working in.
- Learning to type like true crazy typists.
I wasn’t happy at that time, till I decided to quit the company I was working for. My decision opened new horizons and a true desire to learn more about everything. Moreover, I wanted to learn a maximum from my fellow work tandem before leaving for new and crazy adventures.
I wanted at the same moment to get rid of my very bad habit of typing with two or three fingers. I wanted to use typists techniques: using the home row keys and my ten fingers.
Quickly I began to understand the power of this typing method. You feel definitely faster and more in control of your computer. A very cool sensation! I knew as well that Vim was designed for this type of typing. Due to the pleasure I had with my new typing techniques, I slowly decided to give Vim a chance.
More and more, I asked tips to my tandem in order to learn how to use The Beast. At first, I just wanted to use it for editing configuration or text files, not for actually coding, too afraid that it would put down my productivity.
I stopped using PhpStorm in two weeks.
Vim vs PhpStorm
Vim on the left, PhpStorm on the right. The clash.
Here we are finally: the comparison between PhpStorm and Vim. Do you want to replace PhpStorm with something more powerful and versatile? Do you want to be sure that Vim is the good choice?
I won’t cover here how to do a PHP IDE out of Vim since I wrote another article on the topic.
Who’s in Charge: You or Your IDE?
An IDE is obviously very important for developers. It’s the tool which helps us doing what we like: coding. It simplifies our life, automatize all those boring stuff you repeat over and over again.
Therefore your IDE should reflect the way you are coding. It should give you the choice for you to do what you want, the way you want.
PhpStorm doesn’t really give you many choices: it is a bunch of tools and you have to stick with them. I never used 70% of it. I know a lot of shortcuts and I am able to navigates in the panels without even using the mouse. However I never used the composer tools / terminal / git GUI / database interface thingy integrated in PhpStorm.
I couldn’t configure that. I couldn’t choose to install what I wanted, what I needed. PhpStorm was choosing for me.
The result? Many panels and notifications popping, a lot of visual noise which was totally useless for me. Perfect to lose focus.
Some may argue that PhpStorm is really configurable compared to other IDE. It is nothing compared to Vim.
Vim has a great community who develop a LOT of plugin. Nowadays you can install them and get rid of them by typing two words. Not even command lines. Words.
You can choose exactly what you want and what suits you. You can even modify it easily and extends it. Vim can be bent following your wishes.
You are the master.
PhpStorm Only Allow You to Code in… PHP
Another point which was bothering me for a long time. Of course you can use it to write HTML / CSS but you won’t have many tools for those. And what about Go you want to learn so hardly? Ruby? Basic?
Even better: the plugins can be activated depending of the file type you are editing. You will never have the Ruby autocompletion while editing a PHP file. Sweet, isn’t it?
I have tons of plugins for refactoring, creating snippets and so on. No need to change IDE and get use to different interfaces. With Vim I can switch from one language to another transparently. Believe me, it’s awesome.
When I open Vim, everything I need is there for whatever language.
Vim is Light
Each time I open PhpStorm I have the impress that my computer is running a marathon. And he doesn’t do well.
Even on my very lightweight arch linux / i3 system (running on very good hardware), everything suddenly slow down. Welcome to the Matrix, or the stop motion applied to computing!
Sometimes I like to open two projects at the same time to get some configuration or code from one to another. Sometimes I want to open even more if I need to work with multiple micro services.
With PhpStorm… you know what I am talking about. Your memory scream, your CPU burns some calories, your vans consume more electricity than your fridge.
In comparison, Vim is a feather. So light! You can run multiple instances of it if you want, your computer won’t slow down. Try to use Vim, then come back to PhpStorm and you will see what I’m talking about.
Your hardware will love Vim.
Vim is Fun
This is something I didn’t imagine: Vim is really fun to use. This is something my work tandem told me, and it’s so true: it’s basically the gamification of coding.
It is time to precise a bit how to use it. There are many modes in this editor:
- The Normal mode is for executing commands (delete words, lines, paragraphs and a lot of others). Basically, it’s to edit your text (or code).
- The insert mode is there for you to concretely write.
A simple separation of concern and, believe me, it’s brilliant!
This is Vim: you can learn to be productive with it in a couple of minutes (I promise). Get used to it may take a bit more time, and then you will learn new stuff all your life. The whole editor feel so logical that you will come up with new way to do things without even asking Google. Yes, by yourself, only!
Like: “Maybe if I press those keys, it will do that eventually. Yes it does! I’m a genius!”
Indeed, Vim is so sweet, you can talk to it like an old friend. For example: you want to delete all characters from your cursor till the coma? In Normal mode, type
dt,, which means delete till
,. You can do as well
dtf, which delete till
In comparison, PhpStorm is boring. To me, 70% of the tools are useless (by adding a useless graphical interface on top on very efficient terminal tools) and the editor itself use the mouse extensively, like 99% of the editors in the world. If shortcuts were invented, it’s because it’s more convenient and fast to use the keyboard to execute actions. Vim definitely nailed that.
To be honest with you, I always have the impression I’m some sort of a hacker doing crazy things with my keyboard in three different Vim instances. Of course I am just writing down my shopping list but… who cares? The feeling is great!
I am always happy when I discover a new shortcut or way to do thing even more easily. It’s like finding a secret way to beat a video game even faster! Gamification, I tell you.
PhpStorm Cost Money
PhpStorm is not free, far from it. Even if it’s pretty affordable (around 100euro), you pay only for one year. Welcome to the era of renting instead of acquiring…
If you want a Go, Ruby or whatever IDE for whatever language, you have to pay. Again.
Vim is free, available on everything (linux, windows, mac).
You Might be Faster with Vim…
Honestly I don’t care that much if I’m faster with it. To me, being fast doesn’t mean being a good developer. Our brain is more valuable than our typing speed.
However you will feel fast and precise, which is a good cherry on the cake. Especially when you have to move a bunch of classes and renaming namespaces again and again. You know, what we call refactoring: Vim can simplify that and many other things.
Vim Allow You to do More than PhpStorm
Here some examples what you can do with Vim but not with PhpStorm:
You can search through open tabs (“buffers” in Vim), files and entire projects very fast with the fzf plugin. Even faster than with PhpStorm.
You can go directly to php.net with a keystroke when you are on a method / function / whatever to see its definition. Very handy.
You can run Vim with a GUI or in the terminal. Doing the last will open a lot of possibility like the winning combo zsh / tmux / Vim. You will have a lot of flexibility and fun with those tools, I can guarantee it!
Since a ton of plugins exist for Vim you can extend the possibilities as you wish. You can even write little functions which extend / alter whatever you want.
The possibilities are infinite.
A Great Community
A lot of people use Vim and will be happy to help you. You have access to a lot of plugins for every development language you dream of.
Some will argue (as I did) than Vim is too old. It is a strength! Think about it: what software is more stable than the one tested for decades?
It is very stable indeed, thanks to the community. If you are stuck, if you have a problem, you have tons of resources where you can found the solution.
Vim is old and maintained for a long long time, which means as well that its codebase is (apparently) not-that-goodish. That is why a bunch of people rewrote the whole editor. It’s called Neovim and it’s compatible with every Vim plugin available.
Even if it’s still in beta I didn’t have any issues with it. It works like a charm.
I want to be in love with Vim! Tell me how!
First you need to be motivated and learn how to properly use it. It is less complicated than you think.
You Work on Linux or macOs? Try Vimtutor!
First, go to your terminal.
vimtutor. Press enter.
Here we are!
Vimtutor comes with a lot of linux-based distribution. It is a 15 minutes tutorial for you to learn Vim’s basics. After that, you can begin to use Vim for whatever need you have.
15 minutes! Who said that Vim was complicated?
You don’t believe me? Just try it!
Get Inspired by Other’s Configurations
Vim alone is a bit… too weak functionality wise. You need plugins, and the best way to find what you need is to look to configurations from other developers. They are most of the time hosted publicly on github.
Be careful though. It is tempting to copy entire configuration from others but you will be lost very quickly. Vim needs to be personalized. It can suits you if you take the time to tune it depending on your needs.
Take the configurations available on the web as inspirations. Copy them little by little, plugin by plugin. Test it, try to understand what the plugin is doing. Take your time. Read the plugin documentations. In short: do everything with Vim you should do as a developer. Analyzing, acting step by step and see if it suits your need.
Vim Cheat Sheet
My advice for the beginning: having a cheat sheet printed you can refer to. You can find a lot of them everywhere.
It will help you memorising the basics of Vim and experimenting to be more effective and have even more fun!
Vim is a Winner! But… Do I Miss PhpStorm?
I hope you are now ready to try Vim, and maybe replace PhpStorm!
Now let be honest with one another:
- Yes PhpStorm has some tool that Vim doesn’t. The search plugin I use for example has less options than PhpStorm’s search… but is so faster, you’ve no idea.
- In PhpStorm the auto completion was slightly better… in 2017. In 2019, Vim auto completion plugins are as good as any IntelliJ plugin.
- You need to spend time configuring Vim to have a powerful PHP IDE. However, it means as well that you can personalize it the way you exactly want it to behave. An IDE should answers your need, not imposing them!
After three weeks using Vim as my PHP IDE, I tried to reinstall PhpStorm. I used it for ten minutes… before coming back to Vim.
I won’t get back to you, PhpStorm. Never. I am a faithful man to Vim now.