Hacker News new | ask | show | jobs
by notheguyouthink 3477 days ago
I know you're seeing a ton of "yes it's worth it" posts, but i just wanted to add a slightly different perspective. Yes, it's worth it even when you aren't an expert at Vim.

I am constantly learning new Vim commands[1], and i feel i only know a tiny fraction of the vim editing language. Yet, i still love vim, and use it constantly, for everything.

The approach i take, as to make it enjoyable and not a job, is: "is what i am doing now annoying?". If you find yourself hitting j (to move down) 40 times in a row, or holding it to move down slowly, etc - Google for a solution[2]. It can be a little annoying in the beginning, but when you're starting out your far less likely to want to "fix" every bad pattern, and therefor you aren't spending all your time Googling. In my experience, you are only improving upon the things that most annoy you, and as time goes on, you improve quite a bit while not even trying.

[1]: discoverability is not it's strong suite, which is why i'm going to try Kakoune. [2]: You can multiply the command (40j), or <Ctrl-f>/<Ctrl-b> to jump. Among other things.

3 comments

Strongly endorsing the "make the pain go away" path to learning, but I'd also like to mention a secret weapon for really nailing down the more powerful movement and editing commands in vim: macros.

Macros are immensely useful themselves and everyone should learn and use them, but they have another benefit beyond simple utility - writing good macros requires using commands that generalize rather than "eyeballing" how many times you should press a key. If you want to move to the next paragraph in a macro, you can't just mash j until you're there because every use of the macro might require moving a different number of lines. What you can do is use { and }, vim's built-in commands for moving by paragraphs that are underused because holding down j is "good enough" for interactive use. I find that after I start using a command to make better macros, it filters into my interactive use soon after.

As a bonus, using more powerful motions instead of repeating weaker motions makes your macros execute a lot faster.

Not much better. You have to count to find out that 40 number.

Sometimes a mouse is faster.

You can set line numbers in vim to be relative, then there's no counting involved.
Should be using ace-jump instead of counting the lines.
Not familiar with ace-jump, but i don't count lines. I use relative line numbers, and just hit the number i want to go down to. Ie, it will say 15 below me, so i hit `15j` if i want to go there.