This a short write-up on how I learned the basics of Vim Motions and what I've learned about it.
One fatal day in 2023 I was browsing my YouTube reccommended feed when I came across a video from the creator Primeagen.
In this video, he was editing code and moving around in his editor at a speed which my VSCode-normal-keyboard-using-feeble-minded-brain simply could not comprehend.
It was clear to me that he was doing something different than I was. I had been practicing speed-typing on 10FastFingers for almost 10 years at this point.
Point being – I was fast at clicking on the keys on my keyboard. But somehow, he was doing things at an order of magnitude faster than me.
In the video, he explained that he was using Vim motions.
Say less. I needed to learn how to do the same.
The first ever text editor, Vi, was created back in the 1970s. At this time there was no mouse, no way to click on things on the screen. So in order to use Vi, you had to do everything via the keyboard.
Was the secret behind buttery smooth, insanely fast programming created all the way back in the 1970s? It seemed strange, but the bearded man on the screen was without a doubt much faster than me.
In the video, he explained he was also using something called NeoVim. Vim was an improved version of Vi – NeoVim is an improved version of Vim.
It seemed like you had to do a whole lot in order to set it up. I really wanted to start using these motions, but I didn't want to do all that.
That's when I found out I could install a Vim plugin in VSCode. Bingo.
So there I am. In VSCode. With the extension installed.
The up and down arrows could no longer save me. I was on my own.
So I start praciticing. I open up a React component and press 21j
All of a sudden I've jumped 21 lines down. Magic.
I know I said I was keeping to the basics, but I remembered a more advanced motion from his video.
I look to the right on the line I've landed on and see a function with some props.
const someFunction = ({ someProp }) => { }
They gotta go.
So I press ci{
on my keyboard.
const someFunction = () => { }
... I jumped forward to the next bracket {
... I deleted all the deleted all the text inside of said bracket
All whilst being at the beginning of the line, mind you.
What the f_ck
After that moment, my life would never be the same.
I had now learned ancient wisdom passed down from the 1970s computer nerds.
Harder, better, faster, stronger – I had become.
It seriously feels like a superpower being able to do relative line jumps, jump down half a page, cut some text based on the surrounding characters and paste it in your previous position.
No matter if you use NeoVim or just the plugin in VSCode, you'll get a serious productivity boost from just using the basic Vim motions.
I've tried to hone in on the basics and I can honestly say it's sped up my coding a lot.