🪷 barelyzen

I have approximate knowledge of many things

Vim motions: oral tradition on the internet

2024-07-31

Last weekend I listened to an interview between The Primeagen and Thorsten Ball: https://www.youtube.com/watch?v=8XweSqTYdMQ. At some point during the interview, they get into the details of how the Zed editor implements Vim motions.

After hearing two experienced developers share tips and tricks about Vim for the nth time, and both of them discovering things they ignored about it, an idea came to me: Vim motions are much like oral tradition.

But, what even are vim motions?

Vim, the editor, introduced the concept of Vim, the motions, which is a set of operators and motions to write and edit text. I'm not going to get into the actual details about the language itself, there already are great resources for that like the amazing articles by Jaime González García or this classic Chris Toomey talk.

The feeling

There are a plethora of resources that teaches about motions, like the ones I mentioned above, vimtutor or even the Vim built-in command :help motion.txt, but I'd argue that those only teach the basic building blocks of Vim motions, the tip of the iceberg.

There is a delightfully different way most of us actually learn to grok Vim: by seeing others use it and copying their ways of combining motions.

And that's a pretty special feeling, a feeling that manifests itself little by little as you start learning about the available operators and motions. A new world of possibilities starts opening before your eyes once you realize that you can start creating phrases by combining operators and motions.

People usually bring up the concept of composition when talking about Vim motions, and I think that there lies the key of the feeling that I am trying to describe. The combination of Vim motions are often described as phrases, and those are either invented by you or transmitted to you "orally" (or in a Youtube video, you know what I mean). There is no specification anywhere about all the existing phrases, those are "discovered" and passed down by Vim speakers to other Vim speakers, very much like oral tradition in a digital age.