I’m using Vim for a little more than one year. I switched in last August, and it’s my main editor since then; I’m writing these lines in it. To celebrate this anniversary, I’m writing a summary of my motivations, experiences, and the learning curve so steep it’s legendary.
I won’t reach hard conclusions whether or not you should switch. It’s a story, and I’m sure if using Vim ever crossed your mind, you’ll find it interesting.
How it started
Around last year February, I had a bit of spare time to kill, and I was thinking about learning something new. I was developing with AngularJS that time, Ruby before that, while I initially started as a hardcore Java dev. These technologies are quite different and learning yet another shiny framework did not intrigue me at that time.
Then came the idea, that typing is a common part in almost everything I do. I read a lot of articles and posts about experiences of others, and it seemed like a good challenge. Vim was not my primary target that time, just wanted to type better. I mostly used two fingers and the mouse extensively; it wasn’t actually slow, and while programming speed is not limited by typing speed, but I wanted to type “properly”.
So my first milestone was touch typing. I googled around a bit, and found many online sources. I realized that it’s less important how I learn it; it’s a matter of hours I put into practice. So I chose one online trainer, and started learning the different keys. I practiced every day; I believe it’s very important in order to learn new things.
It was hard at first. I still feel how exhausting it was to stare at the screen, thinking about where the letter “g” is located on the keyboard. I still mistype “k” and “l” occasionally. It took me like two weeks to build up a basic muscle memory for the essential keys.
After the initial period, it became fun. At last, I wasn’t thinking about each and every character and it’s a good feeling to be able to type a whole word with strokes in rapid succession. The progress was still slow, but I observed improvements every week.
It needed months of practice to reach an adequate level. I still can’t type fast, but at least I don’t need to constantly look at the keyboard. Also, I’m able to just “feel” when I mistype something.
Did it worth it? Absolutely! It took a long time, but it’s like promoted to a pro after being an amateur. I know it does not improve my coding abilities much, but I still feel it made me better.
I learned the standard qwerty layout back then. I read about Dvorak and Coleman, but as I heard they don’t offer that much benefit. Maybe at 100 WPM they are sensibly better, but I’m not aiming for that. Also, I’ve found out that good posture and a little warm up goes a long way; my fingers do not hurt, and my accuracy is definitely better.
Dávid was using Vim for a while then, and always told me about his good experiences. It’s heavily geared towards touch typing; even escape is remapped to CTRL - [, to accommodate the fingers at the home row.
Since even the basics are quite complicated, I started by reading the Practical Vim book, trying out the stuff I learned along the way. It took like two months; yep, its learning curve is that steep.
People all over the internet are saying that you should disable the arrow keys when you learn Vim. This is because it’s so much easier to navigate using them when you are starting out; but it’s an antipattern, and you should build up muscle memory the hard way.
Since I was touch typing, it wasn’t an issue for me. I got accustomed to hjkl almost from day one. What helped me was a script that prevented using them without a count. It made moving by one character/line much tedious, and eventually I started to use the word/search movements more. But still until today, I find myself pressing 1l1l1l every now and then.
The most obvious advantage is that I use the mouse a lot less. Before I started using Vim, I used the mouse and the keyboard together; pointing where I want to edit something, then grabbed the keyboard and press a few buttons, then back to the mouse. I didn’t realize back then how slow and tedious it was. Using only the keyboard without the need to switch back and forth is something that transformed my typing.
On the other hand, I rarely type for long uninterrupted intervals. I usually write some code, then go back to the browser and see if it works. There are some plugins to ease that, but I usually need to use the mouse then.
Vim supports touch typing to the fullest. I usually do not need to move my fingers to reach far away keys, and I can just keep looking at the monitor while I type. This is an important feature I’m yet to see in other editors.
Plugins are quite essential, as the basic configuration is hardly productive. Fortunately, many people share their .vimrc, so that you can start from a nicely configured editor. It’s a great way to get up to speed, and once you get comfortable, you can personalize it to your own needs.
Another advantage is the abundance of plugins. You can find snippets and repos for just about every problem you’ll have. Also, it’s highly configurable. In theory, you can add motions, shortcuts, snippets, and just about anything to ease your work. Once you get to know what your specific needs are, chances are you can define a shortcut for that.
One great advantage is the community. If you have a problem, it’s likely that someone else had that earlier. Just Google it, insert into your .vimrc, and you have a very new feature, that solves your particular problem. If you take a look at the available plugins and scripts, you can easily find something useful. This is how I stumbled into vim-surround, rainbow parenthesis, ctrlp, and easymotion. It’s like Christmas, every time I need it.
What I particularly like in Vim during text editing is the multiple clipboards and the markers. During refactoring, inserting the same text to many places is often needed. It took me some time to get used to the multiple clipboards, but it really speeds things up. The same is true for the markers. Oftentimes I find myself jumping between a few places, and markers come quite handy.
One interesting advantage is that coding in Vim is low-level. I can edit text, then I need to know what command to use in order to build the app, how to test it and so on. When I was using an IDE, there were several automated things that just worked, but I had no idea how. For example, I know where to click to package my android app, but I have no idea how to do it manually. If you are using Vim, you get an intimate knowledge about the code; you’ll know every tiny bit, and you always know what’s going on.
One advantage people say all the time is that Vim works just about everywhere. It might be true, but I hardly ever use it outside my main computer.
And finally, its requirements are like nothing. It uses virtually no memory or CPU. I’ve used IdeaJ before that, and I got used to running out of RAM every now and then. Since the switch, Chrome is the #1 memory killer instead of the IDE.
Since I tend to doubt an article if it’s all about the positives, I’m writing about the downsides too; there are quite a few.
Learning Vim is a heavy investment. People all over the internet are writing about the steep learning curve, and I can attest. It took me months to reach the level of productivity I had with a modern IDE, and even then I’m waiting for my speed to skyrocket.
Since text editing is much more complex than just typing in text, I occasionally experience brain fog when I’m tired. It hinders my ability to navigate the files and the current buffer more than using a mouse.
To use Vim effectively, you need plugins. Without them, the editor is a lot less welcoming. This renders starting out a bit harder. On the bright side, you can start with someone else’s .vimrc, hoping that they already made it more comfortable.
The biggest drawback of Vim is Vimscript. I’m working as a software dev for a decade now, and decided to give it a try. I made my way through an excellent book on the subject, and I must say it’s horrible. I’m pretty sure that if someone invests many hours mastering it, then they can bend Vim to their will, but the language itself feels it’s a remnant from the past. My problem with this is not that I want to develop new plugins; but it will discourage people who would.
Compared with an IDE, Vim has less language support. It’s a generic text editor, and not geared towards a specific programming language. It has many features like text completion and ways to quickly navigate through the codebase, but I miss deeper integration. I used to ctrl-click into a Maven dependency which is something you’ll still need an IDE for.
Did all the hassle of getting started worth it? Yes, it transformed how I look on text editing. It’s a refreshing change, and I’m glad I went all the way through.
Will I stick with it? Probably not. It might come as a surprise, but I feel that writing and, especially, understanding code is much easier with an IDE.
But in order to change, I’m looking for a proper replacement. I tried Atom, but couldn’t make it fully compatible with touch typing. It has a Vim plugin, but it does not support a few features I’m using, and also had to reach for the esc key quite often.
The next time I feel like experimenting, I’ll give Sublime Text a go, then IdeaJ. After a quick Google search, seems like they have Vim-like plugins, and might be suitable to replace it.
Until then, I’ll be happily using Vim.