Learn Vim, Use Atom

Why Bother to Learn vim ?

We live in a world where we have lots of modern, high quality options when it comes to code editors (more on this later). So why should anyone take the time to learn vim and tackle vim’s supposedly steep learning curve? The answer is really very simple. The keyboard.

vim ’s user experience has been designed around providing the user with the most power possible, without needing to stray far from the comfortable home row on a QWERTY keyboard. I didn’t realize until I started using vim how much time I spent fiddling around with the mouse. I don’t have any empirical data, but I’d guess that I spend at least 50% less time touching a mouse or trackpad than I did before.

Another bonus is that vim was designed by developers for developers. It can be made to interact with any number of other tools and has a strong plugin ecosystem.

Fine, But How?

I believe Mark Twain said, “The reports of vim ’s learning curve have been greatly exaggerated”. Or something like that. ¯_(ツ)_/¯ Anyway, learning vim is only as difficult as you make it. I will concede that you are likely lose some productivity for the first few days of regular use, but don’t let that deter you. I opted to make the jump at the same time I was moving to a new job, so that the productivity loss wouldn’t be so painful. You could apply similar logic and try to pick it up when you start a new project, or some other time when there’s less pressure to be at the top of your “ship it” game at all times.

There are a ton of resources to assist the learning process. There are two in particular were incredibly helpful for me. First, is a vim “distribution” called janus. It provides a baseline

configuration including some plugins, meant to bring vim ’s feature set more in line with modern editors like Sublime Text or Atom. The other is the free “graphical cheat sheet based tutorial” provided by ViEmu. They break vim commands and motions into 7 easily digestible lessons. Starting from the basic modal editor functionality and moving into more advanced topics as the lessons progress. The cheat sheets can be downloaded as PNG files.

I found that it was helpful to set a lesson as my desktop background until I was comfortable with the skills it taught. Then I did the same with the next, and so on. The easier it is for you to reference the cheat sheets, the less productivity loss you’ll experience. I also suggest using a GUI vim flavor like MacVim or gVim so that you can still use the mouse as a crutch when needed. Another fun resource, that I haven’t used, but could be of interest to some, is Vim Adventures, a tutorial disguised as a web-based game. If you prefer learning via screencast, there is a well regarded series available.

OK, Now Switch

I hear you. You’re saying, “Wait? What? I just spent all that time learning vim and now you want me to switch to a different editor? What the hell, man??”

You’re right. It seems counterintuitive. Remember what I said earlier about modern, high quality editor options, and editors built for developers by developers? In many ways, Atom is the modern ‘reincarnation’ of vim . Its plugin system is better, and is powered by technologies most developers have at least been exposed to. Writing vim plugins requires a knowledge of vim ’s own scripting language called VimL, and I don’t have a clue how one would modify the UI in any significant way.

Atom changes all that. It already has an incredibly strong plugin ecosystem, and since it is webkit based, plugins and customizations can be written with JavaScript and other web technologies most modern developers are familiar with. The thing that really seems counterintuitive is that by default, Atom is NOT a modal editor, so the vim skills that I encouraged learning in the last section don’t seem to apply. Fortunately, there is a surprisingly mature vim-mode plugin that brings a lot of the power of vim ’s modal editing to Atom. Some hardcore vim -ers might find vim-mode lacking, but for me, the power of the package system and being able to make UI customizations with CSS makes up for any current shortfalls of vim-mode.

It’s also worth mentioning that vim-mode is under active development, so it should continue to be pushed toward feature parity with vim .

Now It’s Time For The Breakdown

Learning vim , then switching to Atom + vim-mode can provide a near-perfect combination of features to increase your personal productivity. Whether it’s reducing unproductive hand movements, installing plugins that reduce unproductive distractions by keeping you in the editor, or using CSS to reshape the UI in your own particular idiom. It’s a bit of a winding journey, but with perseverance and patience, you will see a noticeable improvement in your personal productivity as vim and Atom help you reduce the amount of time you waste on minutiae and distractions.

More Posts by Adam Clarke: