There are two very useful keys for navigation in vim: find and till. I am using both daily and these are one of the keys I have learned somewhere at the very beginning of my vim learning curve.

To explain briefly, there is a group of a so called motion keys, performing a cursor movement - the infamous hjkl keys are also part of the motion keys club. Pressing f followed by any character moves cursor to the character. Similarly, pressing t followed by any character moves the cursor before the character. In both situations, the movement only happens on the same line. If the character is not present, nothing happens. Very useful for navigating.

Both these have the counterpart of moving backwards, so F moves the cursor to the left stopping at the character, while T moves cursor to the left, stopping just before the character.

Using count with find and till keys

Each one of find, Find, ttill and Till support [count], so pressing a number before them will move to the n-th ocurence, for example 2fa would move the cursor to the second nearest a character on the same line to the right. What a news!

Now the above fact might be obvious to many vim users, so I may even feel ashamed for writing about it, but hey, it was a todays revelation for me, so I decided to blog about it anyway. For the record, it is all documented, just look at :h f and :h t. Sometimes I feel like reading the vim help to learn that sequences like these exists, but this is actually something I have found out about by an accident. Yeah, yeah, vim accidents. Discovering features by mistyping key sequences. I wonder how many times this happens till I admit I do not know vim at all after these years.

Repeating the last find or till

There is however one additional key to all this that may not be as obvious and it is ; or the mighty semicolon. The same way the dot . repeats last action, the semicolon ; repeats last motion performed by f and t. What's more, the semicolon's counterpart is a comma , and it is performing the motion in the opposite direction.

I have not known about these two either and learned about it from the help and it seems pretty useful too. Yet I was always wondering what the ; and , keys do. And it is so easy to find out, just :h ; or :h ,.

Okay, okay. I admit it. I do not know vim even after all these years of daily use. And I do not plan to stop learning it anytime soon.

This is a 85th post of #100daystooffload.