Vim, Instinct, and Muscle Memory

Ryu mastered motions and operators before mastering Hadoken

One thing that came out of my talk on Custom Motions at Vim London was the idea of instinctively hitting the escape key to leave a mode. I first started to think about this when I came back to my computer and the screen had slept. I hit a key in order to wake the screen, and then I was presented with a Vim session. Since I didn't know exactly what key I'd hit, I pressed escape because I knew that would put Vim back into a familiar state.

If you also find yourself doing that, it's probably because at one time or another you've accidentally entered into Operator-pending mode. Vim has no visual indication when this mode is active -- it's like a sub-mode of Normal mode.

Most of us tread between instinctive Vim usage and formalised knowledge gleaned from the rare times we've wrestled with the documentation. This gap in formal knowledge is why reflexively hitting the escape key is burned into our muscle memory.

I usually regard muscle memory as something closely intertwined with video games -- I've always been terrible at Street Fighter 2 but I can still pull off a Hadoken to this day. The same is true with Vim. I used it for years before I started to question what motions, operators, and text objects are. I used them all the time, but didn't have a solid understanding of the jargon, which made trying to understand Vim's documentation difficult.

So if you're an instinctive Vim user, my advice to you is to stop worrying about mastering macros, undo branches, and window management, and sit down with the manual (or Usevim) and relearn the basics. Get to grips with operators, motions, text objects, and see how they can combine to make your everyday editing chores more efficient.

blog comments powered by Disqus