home / blog

learning vim properly for the fifth time

~ March 18, 2024

I started learning how to code in my second year of high school, on a modest Friday afternoon. I sat in the back corner of my school’s coding club with my laptop on the floor and eyes watching attentively the instructions being announced by the speaker. “It’s very easy to get started with Python,” the speaker said, “just follow these steps.” And these steps were as follows:

  1. install the python interpreter, then
  2. install the Pycharm IDE, and
  3. click the big green triangle button to run your code!

And it worked first try! From that point I was hooked, and I rushed home to teach myself the ins and outs of Python. I spent a couple of months with Python and Pycharm, and it all worked out great.

But soon I started to realize the limitations of Pycharm. This came as I begun to work with other languages, ones that Pycharm simply is not meant for. First there was Java, for which I needed to install Eclipse. Then there was C++, for which I needed to install CLion. And then for JavaScript… I didn’t even bother at that point. Furthermore, it was not helping that all these big, powerful IDEs were taking a full minute to launch on my laptop. What I needed was a code editor that had both support for a wide variety of langauges, but also was lightweight and fast.

And that’s how I stumbled across Notepad++ VSCode. It seemed to be exactly what I was looking for – it was snappy, extensible, and had a very simple UI. Over the years I iterated on my VSCode configuration, until it became what it is today. As I got more comfortable working with a variety of languages and tools using VSCode, my main focus shifted away from learning new things, and towards how I could work with what I already knew more efficiently. For this, I started to use keybinds more and more frequently, and even configured a few of my own custom keybinds. These saved me a lot of time from having to click through menus, or moving my cursor around. I soon got very comfortable with these keybinds:

  • <ctrl> + s to save,
  • <ctrl> + d to select next occurence,
  • <ctrl> + <shift> + l to select all occurences,
  • <ctrl> + <shift> + x to cut without copying,
  • <ctrl> + <shift> + f to format the current file…

The list goes on. But what made these keybinds so nice to work with were the similarities they shared with other applications I was already familiar with. It only seemed natural to save with <ctrl> + s, to copy with <ctrl> + c, to paste with <ctrl> + v. And as with anything comfortable, it’s uncomfortable to divert away from it.

However, there was something that lingered in the back of my mind ever since learning about it. What if I could work even faster? And the solution to that came in the form of Vim. Frankly, I was scared of Vim, it seemed like this prehistoric technology that could not compete with the developments of the modern world. Yet, I wanted to try it… to conquer it regardless. The demos of people using Vim I saw online were undeniably impressive.

And so I set off on my newest adventure, to master Vim. I thought there be no better way to learn than to plunge myself right into the deep end. After all, this was how I learned so many other things before, I could surely do it once more. I followed the instructions to install Vim, to install a plugin manager, to install LSP servers, I did it all. Then after all that I sat down to edit my first file. It seemed quite easy actually – j to move down, k to move up, "ay to yank into register a – okay, maybe I’ll worry about registers later. But all else seemed fine. Until I pressed <ctrl> + v to paste. Nothing pasted. Right, that command enters visual block mode, whatever that means. And soon, one after another, I realized none of the commands I was familiar with worked. Neither could I use my mouse to move my cursor somewhere. Vim did not help me go any faster, it near halted my productivity to nothing!

I was triumphed by Vim, for the first time of many to come. I forgot about Vim and went back to VSCode. Yet, VSCode felt more and more unsatisfying as time went on, each time having me wonder what it would be like had I not given up on Vim.

And so I tried learning Vim for a total of four times, each to no avail and returning to VSCode.

~

Recently I had another one of these epiphanies. I found myself having to write tens of thousands of lines of code, and having to switch back and forth between my keyboard and mouse really slowed me down. I looked to Vim once more. But this time I decided to approach it differently. In every previous attempt I went full on with Vim, and the sudden change came with a sense of shock that had me give up each time. This time, I simply installed the Vim keybinds extension in my already familiar VSCode, and vowed to myself I was not going to uninstall it no matter how uncomfortable it became.

And it worked. Something just seemed to click in my head that had not before, and the Vim keybinds did not feel as unfamiliar as before.

Maybe one day I’ll explore terminal based Vim once more. But for now, VSCode + Vim sets a nice middle ground for my usage purposes.