Vim - a coding alternative

Many will argue that Vi/Vim is an extremely old editor with no benefits to development whatsoever. I won’t get into that, the web is full of articles and/or rants in favor/against vi.

My personal take on the matter is that I HAD to learn about it (because you can’t really learn everything) so I can decide if it’s usefull or not. And it took me 4 tries. The learning curve is extreme, I can’t remember anything being harder to learn. Not because of the system itself, but because it is against everything I’ve learned so far in terms of editing. You cannot just start typing. Or... you can, but the results will be nothing you would expect.

The main issue with learning vim is that there are sooo many shortcuts to remember. This is why I needed 4 tries to get vim working. On my last try, I decided that the huge amount of shortcuts can wait; first I need to learn the basics (like moving around) and then incrementally add 3-4 shortcuts/week so they can be ‘stored’ in muscle memory.

Then, after I was comfortable enough moving around, I started google-ing for various vim commands, depending on the situation I was in. For example, since I have Caps Lock mapped to Escape (for easier switch to normal mode – again, personal preference), I had to learn how to capitalize text. I’ll add the shortcuts in the motions article.

One thing I should mention… this is not really an article about Vim. You won’t find .vimrc configs in here. I did configure Vim awhile ago, but I didn’t use it in the end. In here, we’ll talk about Vim main features and how I use it in my favorite IDEs.

1. Navigation - the first (and biggest) bump

This is surely the thing that drives people crazy when they first get to know vim.

Well, you can always use the arrow keys like in everything else, just don't touch ESC. It’s just not the recommended way. Instead, you are introduced to h,j,k,l navigation.

0 mins read
Tags: vim

2. Vim modes

This serves as a quick intro to modes. There are countless resources out there that go into every detail of the modes, I won’t touch that.

The thing to remember here is that editing in vim means constantly switching between vim modes. And that can be daunting at first, until muscle memory kicks in. And that’s when the ‘fun’ starts. A possible downside is that I’m trying to do that while...

0 mins read
Tags:

3. Yank

Again, vi does this in a different way.

It looks like we have to learn Copy-Paste again. It may seem like crap at first, but remember that it's just a matter of time until it stores in muscle memory.

0 mins read
Tags:

4. Motions

So far, we've learned a few weird features that don't make much sense when used separately.

If you learn motions (you don’t even have to master them), all the other vim features will fall into place. At least, that’s how I saw it. And by far the most used component. Together with h,j,k,l navigation, this is how you move and edit things.

0 mins read
Tags:

5. Vim Gems

Learning vim is a never ending process and just pasting every predefined shortcut there is does not help much. Quite the opposite.

And when you find out that you can define your own shortcuts that can literally do anything, you might feel overwhelmed and just quit. I quit 4 times before finally starting to get a grasp on it.

0 mins read
Tags: