Archive for scrabble

Moving on

So, if you’ve used Vim a bit then “hjkl” is hopefully second nature. Moving by objects (w/W/e/etc.) makes things easier but it still lacks finesse. One of the best tools for moving in Vim is f and its variations. When we use f we’re doing a find for a single character on the current line. This allows us to jump straight to (or very close to) the point we next need to be at without using the mouse.

Example

As always, the best way to learn is to see it. In the below sentence, my cursor is on the first character on the line in normal mode (I):It was the best of times, it was the worst of times.
Now if I wanted to jump to the word best, I could press w a few times. However, fb will find the b with way less effort. As usual, it’s mnemonic so it doesn’t require extra thought to think of the command. It just works:It was the best of times, it was the worst of times.

F, t, T, “,” and “;”

To make finding extra powerful, here are a few bonus commands:F – searches backwards on a line.t – same as lower case f except it stops a character early.T – same as T except backwards on a line., – find next occurrence of character (can repeat until there’s no more).; – same as “,” except backwards on a line.

Scrabble grandmaster

Ever played Scrabble? If you have then this last tip will make your life a whole lot easier. Luckily, it’s still easy to remember if you haven’t played. Try the above commands in a vim session for a few minutes. Very quickly, you’ll see that it can sometimes be a bit tricky to nail the exact character you’re after and you might find yourself resorting to “hjkl” to get there. One way to solve this is to try to mentally note which “high value” letters are near the place you’re trying to jump to. In Scrabble these letters are the ones with higher points but in English we just mean the letters we see less often (z, x, b, y, etc.). Let me show you an example to get my point across:

Insanity: doing the same thing over and over again and axpecting different results.

Oops! I’ve made a typo. Instead of expecting I’ve written axpecting! What a numpty. My first instinct might be to use f to jump to a right? Notice that high value x right beside it though? Instead of doing 5 or 6 jumps, I can just do one. fx followed by i and backspace once to correct my mistake.

Insanity: doing the same thing over and over again and expecting different results.

Keep an eye out for those high value letters. Don’t forget that capital letters and punctuation can be found too and might be higher value.

If Sherlock Holmes was alive today (and non fictional) I'd wager he would be a great developer. The plan for this blog is to provide succinct and useful investigations into software topics, aimed at mainly backend developers, hobbyist data scientists and anyone with a curiousity for the technical.