13 Jan, 2014

I have used Vim for more than 3 years. But starting some two weeks ago I switched to JetBrains IDE products (PhpStorm and PyCharm). In this post I will try to present my reasoning, and try to argument why you also can be better of by switching from Vim.

0. Intro

First of all, several things I wanted to stress:

With that in mind, let me outline what is important to my daily workflow, and argument how it is better served by JetBrains IDE than it was by Vim.

1. Super-effective source code editing

As I said, Vim is amazing when it comes to text transformations. I really love Vim modes, I find them amazingly logical and believe that they afford the unsurpassed ability to navigate and manipulate text by char, word, page, line.

I will not go into details on amazing features Vim as a text editor supports, suffices to say, that I wouldn’t switch to any other editor if it didn’t emulate Vim within it. And not only basic movement keys, but some more esoteric features (say macro recording).

So, the first thing I checked after the installation of PhpStorm is how good is the Vim emulation in its IdeaVim Plugin.

To my surprise, the emulation is really good! It covers most of my text editing use cases, and while it still required me to change some of my ways (for example I am used to <Leader>s to save files, and my <Leader> is ,), nothing too drastic, so I has been able to get productive in a day or two.

Given the fact that I am still learning the IDE’s shortcuts and tools, I will definitely be even more productive as time passes.

2. Ability to work on my projects on different machines

This one was a real show-stopper for me.

You see, I have a fully configured virtual machine sitting in the DigitalOcean cloud, and in order to work on some of my projects, the only thing I need is a terminal.

Since I have at least 3 different locations from which I can work (with dozen of possible workstations), being able to work on my projects without need for manual syncing is extremely important.

I seriously considered using sshfs to mount cloud partition to my OS X box, but network performance wasn’t worth doing it.

Another obvious option was to use Virtualbox, and simply share machine image between workstations. However, configuration management and machine orchestration wasn’t as easy on Virtualbox as I wanted to, so I continued my search.

That’s how I discovered Vagrant (which can use VirtualBox as provider) and Ansible (which is amazing for machine provisioning).

Now, setting up my development environment is as trivial as git clone project-url and vagrant up.

Of course, running VMs + non-lightweight IDE (such as of JetBrains) requires you to have powerful host machine. In my case, all machines I have access to (including my laptop and desktop) are really good, so it is not an issue for me.

3. Really tight integration with CLI

I love command-line. Here, I said it!

For example, I prefer to use git from CLI, and let me assure you I am more effective/quick/productive in that mode than you with any of your slick Git GUIs over there :) However, sometimes I need to diff/merge something non-trivial, and vim-diff (+ fugitive plugin) is ready for the task. So, while I prefer to work with external tools from command line, I expect certain support from the platform as well. And here JetBrains shines even more!

You can have a fully-functional terminal right inside of your IDE (well it has some non-critical limitations, but still a terminal inside a GUI-based IDE!). And of course IDE has really deep support for de-facto standard tools such as version control systems or testing frameworks.

When using Vim, I used it inside tmux, so that I have one window for editor and another for SCM (or running Unit Tests). With JetBrains IDEs, you can have all these tools inside the single app. Greeaat!

4. No mouse, please!

If possible, I prefer to do all the magic with keyboard. No mouse/trackpad is needed.

Vim allowed me this, when it comes to PhpStorm, I can do more or less the same, but not completely mouse-free yet. But this, I suppose, is not the issue of IDE itself, I just need more time to learn the key mappings (and create shortcuts).

5. Windows, tabs, project tree etc

Overall, if a bit different, buffer navigation and management in JetBrains IDE is certainly on par with that of Vim.

Btw, did I mention that you can do all that magic w/o mouse (need to define shortcuts)?

6. Code navigation

If you are paid to produce code, it must be easy for you to analyze and navigate inside of that code. Vim has some support of this (with ctags), but JetBrains certainly does a better job here. While still not ideal, PhpStorm was able to figure out namespaces, parent classes, and overall class structure. Jumping around the code is easy and cheap (stimulating one to explore).

I am yet to discover the most productive way to jump around inside a single file though (and Vim has lots of tools to it), but even now I seem to be mostly comfortable with maintaining my current project.

7. Compilation, Transpiling and 3rd party external tools

When working on a complex software project, you are also very interested in testing, checking, validating, transpiling and whatnot of your source code.

Each of this can be done using CLI (if not, then it should). And as such, you can bind it to Vim (via plugin or key map). The same is true for the PhpStorm - it allows you to utilize 3rd party tools effectively.

For example, take LESS or CoffeeScript files. Nothing stops you from watching the changes in your source files, and fire a traspiling tool that will produce CSS and JS files respectively.

And if you need a truly real-time transformation you need to setup some watcher manually (say using iwatch or inotifywait) and fire transpilation on change.

Everything is nice and clean, but manual.

In PhpStorm you can add (and export/import/edit) file watchers using straight-forward UI. Basically, those watchers allow you to produce traspiled versions of your files on-fly. The IDE is smart enough to wrap the generated file inside the source one, creating a less cluttered UI.

In my current project I use LESS, CoffeScript and Twig processors, and adding new processor is as easy as to define new watcher on a given file type.

Overall, I was pleasantly surprised how well does JetBrains IDE play with external tools.

8. Features not (easily) available in Vim

Intellisense code completion: not as useful in dynamically typed languages, but still quite impressive and helpful.

In case you want to jump right in: I know how well can Vim auto-complete text files (and I am aware of its lots of auto-completion modes), but there’s no acceptable intellisense auto-completion in Vim (even with Eclipse’s Eclim plugin, it is buggy at best). Period.

There are no other features that I am not used to, but all that I am - are present (code folding, todo management, database console etc).

9. Conclusion

If you love being productive with new technology stack more quickly (without fishing for plugins, reading articles on how to correctly setup it in Vim), you need to rely on ready-to-use solutions. And JetBrain’s IDEs are amazingly complete, yet extensible!

So, if you have powerful host machine, setup your development (and staging, and production) environment using Vagrant+Ansible, install JetBrains IDE and proceed!

On less powerful boxes, nothing stops your from ssh’ing into your Vagrant box, and develop code in Vim (which can be installed and fully configured using Ansible).

Written in Vim on 13th of January, 2014 :)

Follow @farazdagi Tweet