Site currently work in progress
For around a year or so I’ve been using VIM within VSC and I’ll be honest like most things in life it wasn’t just a case of pick it up and you’re away, it felt clunky and for a brief period it actually slowed down my productivity. So much so that a with previous attempt to use VIM I went ahead and uninstalled it, I couldn’t grasp why it was so widely adopted I mean how much effort is it to just move your mouse?
I persevered, I pushed through the slow uptake and I’m very happy I did and I feel like I navigate my code much more smoothly than before (not that I had a problem previously, it has just added to the experience now).
Now one of the “selling points” people tend to use is the time saved you’ll get by not moving your hand to your mouse as many times throughout the day, even if this is the case and it saves 60-90 mouse movements throughout the day, you’re talking about 3-5 minutes per day.
You’re not going to magically save hours a day using VIM the speed difference is negligible, for me it’s about the control over the editor I get
It boils down to control and speed of navigation. I’m not an out and out VIM pro and I will still very often use the mouse but the ability to yank lines or code, remove blocks, jump around the page… you name it with just a few key presses is fundamentally better than the alternative. Let’s look at a couple of examples.
Let’s say I wanted to delete a single line
Press “dd” so the letter d twice in quick sucsession and you’ll remove the line, not only that it will be copied to your clipboard and you can paste it again with the letter “p”.
Now let’s say I want to remove all the content between the bracks
Navigate your cursor between the brackets and you want to press “di” and the character you’d like to delete between, so in this case “}” our command becomes “di}” which means, “delete inbetween }”
You can change this too, for example “dit” to become “delete between tags”.
Finally, let’s delete this function, a block of code.
Typically I would need to grab the mouse and select the lines and then delete or cut the code. That’s perfectly fine obviously, but let’s say we use VIM.
Pressing “SHIFT + v” to enter visual mode and then “SHIFT+]” will select all code between the current line and its closing block, I can then just go ahead and press “d” to delete that line and it will automatically be copied to my clipboard, say I make a mistake I just press “u” to undo.
The beauty with VIM is that once your muscle memory starts to kick in, you can perform tasks very quick!