Vim Adventures

Vim Adventures

Many years ago, I tried to learn Vim. I don't remember what prompted it but I tried it. But it didn't stick. There were too many keybindings to learn, and I kept forgetting them.

I even tried Vim Adventures. But there were just too many things to learn, so I eventually gave up. And I didn't think much of my attempt. I happily switched from Sublime Text 3 to VS Code to Webstorm.

I've been using Webstorm for over 5 years now. And during the entire time, I loved it! Everything worked out of the box, I didn't have to hunt and install plugins for necessary functionality (looking at you VS Code), and it was fast.

Recently, two things happened that reminded me of Vim. One was Why we 💚 Vim and the subsequent Why Neovim episodes on The Changelog podcast.

Something one of the guests said stuck with me:

If you think about the timeline - just for me, 15 years; at the beginning of that time, TextMate was just becoming popular. Then it was Sublime Text. It was cool. Then Atom was cool. Then VS Code was cool. A lot of people switched between two of those, three of those, maybe all three of those, and that whole time I was just getting better and better at Vim… And you multiply that out by the length of a career, you use Vim for 40 years - you’re gonna be so good at it by the end, and it’s still gonna be totally relevant, I think. — Gary Bernhardt

That's when it struck me that learning how to use an editor like Vim is an investment as a software engineer. The time spent learning and getting better means that you can navigate a codebase at the speed of thought, instead of clicking around with a mouse. A lot of things that we do in our code editors like VS Code and IDEs like Webstorm are pure overhead. Those are little bits of decisions that add up.

For a long time, I've been fine with that. Most of us are fine with that. We don't really look for ways to improve productivity as developers. But somehow after listening to these episodes I started thinking about it.

The thing that finally pushed me over the edge was watching ThePrimeagen's livestreams on Twitch. If you know him, he is a wizard with the command line and Vim. Watching him navigate code in his projects, I was dumbfounded. Was this how the other half lived? How does he get around so fast? So I checked out his Youtube channel and turns out he has a playlist on Vim for beginners.

Starting with the absolute basics and the minimum required keybindings, he takes us through Vim and how to start using it as our code editor. Each video covers more and more keybindings.

So I followed his advice. I started using Vim keybindings without using Vim. I installed IdeaVim plugin in Webstorm and used the basic keybindings from the first video to get around. My productivity tanked immediately. Doing stuff was very hard, I got stuff wrong all the time, and overall I was very slow.

But I stuck with it. I'm currently in week 4 of using Vim keybindings, and I gotta tell you that I'm way faster than I was before using Vim keybindings. The same navigation that I found hard in week 1 is now close to being muscle memory. I've also watched more videos in the series (till part 4) and learned more keybindings.

The more recent ones I've learned are not yet second nature but the ones from the first week are almost there. So for the past few days, in my free time, I've been spending time setting up Neovim.

Neovim is a fork of Vim and a lot of people seem to love it. But setting up Vim/Neovim is a daunting task. On it's own, Neovim is pretty bare bones. It gets the job done but a lot of functionality that we enjoy in IDEs and modern code editors have to be added manually. But that's a great thing about Neovim, because it has a rich plugin ecosystem.

There's plenty of plugins like treesitter (for highlighting), telescope (for fuzzy finding), autocomplete, and more. While I hated doing this for VS Code, I like doing this for Neovim. The reason is because, Neovim is made to be customized. You can tailor it to work exactly like how you want it.

How often can we say that about Webstorm or VS Code? How often is software customizable to fit into your workflow and your thinking instead of the other way around. It was the reason why I fell in love with Linux. And now I'm rediscovering my love for it all over again by designing an IDE from scratch, that works just the way I want it.

Except it's not 100% my way. Since I'm new, I'm borrowing stuff from people who post their Neovim configs on Github, making changes as I go wherever I see fit. It'll take some time before I figure out what exactly my way is but when I do, I'll know enough to change how things work.