Welcome back to emacs rocks!
In this episode we'll take another look at the vimgolf challenge in episode two.
These two emacs enthusiasts twittered me last night
with an even better solution to the problem
let's take a look at what they did
okay, I'll just run through it first
wow
that was ten keystrokes - it's almost like magic
the trick being used to shave off another two keystrokes
from last nights solution was transpose-lines
let's take a look at transpose-char first
if I typo like this, I can go back and switch
did you see it? switch!
but another way of thinking about transpose
is that you're actually moving the char forward
so that's what's being done with transpose-lines
ctrl-x t, and I move typo down
so that's what they're doing
I start ctrl-x t, ctrl-x t
and use that to move the first line down
okay, I'll walk through it
macro, 9x transpose-line
backspace, tab, back to the top
done with the macro, 9x repeat macro
amazing
so, best solution in vim: 17
last night: 12
today: 10 keystrokes
so thanks to Bodil and Christian for an awesome solution
if you want more of @emacsrocks, just follow me on twitter