My four mistakes with Vim

I have always been curious about using Vim. The legend says you can write/edit text at the speed of thought. As a coder I have always been intrigued by that, and hoped to unlock the “code at the speed of thought” trophy by mastering it.

A few years ago I tried and installed Vim using a Visual Studio plugin called VsVim, which emulates most of Vim commands. I wasn’t very familiar with any of it or Vim’s modal nature so I naively thought I could easily pick it up just by using it.

The experience was awful.

I couldn’t get anything right, I was completely confused by Vim’s modal nature. Instead of writing code at the speed of thought I wasn’t actually writing anything that made sense whatsoever. I then tried to kill Vim with fire.*

*Vim was still fine after…I wasn’t..

Mistake #1 – I completely underestimated Vim

Curiosity was still there when a few months ago I decided to look at Vim again. It was difficult to grasp if Vim was still worth learning in 2020 with a lot of IDEs and plugin out there. However the idea of “writing code at the speed of thought” was still in my mind. Unfortunately, no matter how many articles I read or videos I watched about Vim I couldn’t really tell whether Vim was worth my while or not. I then figured there was no other option but to learn Vim myself if I wanted an answer to that question.

I also asked a few friends from different coding backgrounds (DevOps, C++ games developers, Javascript, C# and Python) what their opinion of Vim was. To summarise the feedbacks I got, except from devops, is that Vim is a sort of hacky text editor for nostalgic old-fashioned Unix users who like to use terminals so that they can call themselves hackers. If you think my friends are horrible you’re probably right and I should keep my dev questions for Stackoverflow or Reddit from now on.

Anyway…amused and a little concerned, I kept on reading articles and watching videos on Vim regardless.

Without some background, it can be very daunting to navigate around Vim. Luckily there are a plethora of articles, videos and books on the topic. Practical Vim is a very good book, I used it (and still reading it) to learn about Vim and I recommend it as it contains a lot of examples and it’s easy enough to read. A fun way to learn Vim if you are into action-adventure type of games is to play an online game based on Vim’s keyboard shortcuts called Vim Adventures. It’s the “Zelda meets text editing” game, I’ve been playing it, it’s fun and polished (but it’s not free).

At first I was actually very slow at doing anything but got better after a couple of weeks. Editing and navigating code was a lot quicker than I imagined. Any change I needed to make had become much simpler. The more I practiced and learned about Vim the faster I become at getting my way around. Vim’s ability to navigate and modify text is unrivalled.

I realised I needed to reach for the mouse less often and noticed to spend a lot more time with my hands on the keyboard. My wrist has been thanking me ever since.

Mistake #2 – Vim doesn’t let you code at the speed of thought

To my regret, after two months of using Vim, I realised I wasn’t any faster at actually writing code. I was definitely faster at editing, refactoring but in the end it was actually very dumb of me thinking I could improve as a coder just by learning Vim commands.

I’ve actually come to the conclusion that if one is able to code at the speed of thought with Vim it probably can do so without it. However if you’re that kind of dev you‘re probably a dev unicorn, please do get in touch I want to capture and study you.

My initial motivations were wrong but I’ve learned something new and I don’t regret it 🙂 Learning Vim is like learning a programming language in itself and it’s extremely rewarding.

It was incredible to acknowledge that very little I remembered about the position of the keys on the keyboard. Despite being able to type without looking I was still not able to reach for a single key directly. For example, using simple Vim commands like h j k l (left, down, up and right) to move around in normal mode forced me to look at the keyboard at least once to position my fingers.

Mistake #3 – I thought I was a touch typist but I clearly wasn’t

Even if it sounds dumb, I always ignored why the letter f and j had small bumps. If you, like me, don’t know why, their purpose is to help you feel them with your index fingers so that you can position your other three fingers on the so called “Home Row” without looking. From there you can then reach for the other keys.

Home Row in a Qwerty layout

Using Vim made myself a better typist (not necessarily a faster one) and has brought to the surface my flaws with the keyboard. I’ve developed a better relationship with it, and I now believe a keyboard is for a developer what a lightsaber is for a Jedi.

Finally, I’ve been able to answer the question: ”Is Vim still a relevant tool to learn in 2020?” The answer is: unless you’re a dev unicorn, a fast touch typist, someone who can edit, write and code at the speed of thought already then yeah learning Vim is valuable and something to consider.

Vim is a time sink though. You’ll spend countless hours. Vim is very much like the English language: “easy” to learn but hard to master. I would recommend to use a plugin inside of your preferred IDE rather than using the original text editor. Don’t get me wrong, Vim has thousands plugins that can make it up to an equivalent modern IDE. However I find it’s better to use an IDE with Vim extensions but I guess it’s very much a matter of personal preference.

Mistake #4 – Why didn’t I learn Vim earlier?

I hope you enjoyed the article and let me know what you think in the comments!