Skip to main content

Vim Carnival: Motion

@hyde over on Mastodon issued a call for "Vim Carnival" posts, with this month's topic suggesting the vim motion that changed everything.

Buckle up, because you get not one but multiple motions that changed things.

The Boring Motion(s)

While boring, you get 6 motions for the price of one: f/F/t/T jump forward/backward landing on (or immediately short of) a target character; and ,/;. to repeat that motion in either the same or opposite direction. I use these all. the. time. And when I find myself using other $EDITORs that lack this functionality, it feels so slow moving around horizontally.

The Epiphany Motion

While simple, the H/L motions hold a special place in my vim-learning path. Not so much the raw motions themselves (which I had used quite regularly), but because they represent a step in vim intuition. At one point I wanted to jump a couple lines below the top line on the screen. Without knowing whether they accepted a {count} I instinctively issued something like 4H and to my delight, it worked exactly as I had hoped/expected. So rather than search or use relative line-numbers (which tend to get a bit laggy over a slow or high-latency SSH connection) I often find it easier to make a coarse jump to an estimated line near the top/bottom of the screen and adjust up/down a line or two if needed.