Hacker News new | ask | show | jobs
by tomku 3477 days ago
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.