I recently ran across the article Why use Vim: Forget easy-to-use design. Choose something hard instead — Quartz. This article suggests that you should learn to use the vim editor because it’s hard.
Although I do think most developers would benefit from using an editor like vim, I feel like the because it’s hard advice is focusing on the wrong thing. I can think of a large number of things that are hard to do that I would never advise someone to do because the benefits don’t exceed the difficulty.
Why is vim Hard?
Let’s start with a question. Why do many people find vim to be hard? Most people answer with some combination of:
- Not user-friendly
- Not intuitive
- Modal
- Minimal (no) use of the mouse
- Cryptic commands
- Does not work like whichever editor you used first
Many of these complaints boil down to the same thing. vim does not approach editing text the way you expect (unless you are a vim/vi user). This mismatch between your mental model of how text is edited and how vim approaches text editing makes everything seem harder. Most editors focus on entering text, whereas vim focuses on changing text. Really understanding vim’s mental model makes many of the design choices make much more sense. By focusing on changing text, vim becomes an extremely powerful tool in the hands of someone who understands it.
What Makes vim (and Other Programming Editors) Power Tools?
The mental model of vim is part of what makes it a power tool. To support this model, the editor has a set of important features:
- Commands for changing text (cut/yank, delete, paste, change, indent/outdent, change case)
- Powerful ways for specifying the text objects to change
- Search and replace functionality with regular expressions
- Support for automating repetition
- Scriptability
These features are specifically focused on the ability to edit text that already exists. Over the life of your typical project, you will spend much more time changing text than you will entering text into a new file. vim optimizes for that workflow.
There are other features that any powerful editor should have, that don’t relate directly to vim’s mental model.
- Syntax highlighting
- Support for multiple languages
- Ability to run programs on the code
- Extension through plugins
- Configurable interface and commands
- Templating or snippets support
Tying all of these together is a focus on reducing the rote or repetitive portions of writing code.
Should You Learn/Use vim?
I find vim very effective for the work I do. But, that does not mean that I would argue that everyone (or even every programmer) should use vim. I use vim because it is a power tool. Power tools are harder to learn than simple tools, but they multiply your abilities tremendously. Any editor that extends your abilities could help you become a more effective developer. I have several good friends that are emacs users. Other than a little friendly ribbing, we don’t really try to convert each other or really care which tool we use. Both are power tools that serve similar purposes. I know people who are very effective with Sublime or TextMate. If it makes them effective, I really don’t have an opinion on what tool you use.
Personally, I also think that challenging your mental model of editing is an effective way to level up in your ability, even if you don’t use vim every day (or ever again). Challenging your way of solving problems, and really learning a new way opens up new ways to think about problems. That is an important advantage when it comes to programming.
Power Tools
The important thing about any power tool is not that it is hard to learn. The important thing is that it multiplies your effectiveness. It’s safe to say that any tool that is easy enough that you can learn everything about it the first time you use it is probably not a power tool. Those simple tools may add to your effectiveness, but it definitely won’t multiply it.