-
Hi! Welcome back to Emacs rocks!
-
It's episode 2 and today I have a real treat for you. Check it out!
-
It's VimGolf! Yay!
-
VimGolf is really cool, I really wish there was one for Emacs.
-
It's a competition and the goal is to transform
-
the starting file into the ending file
-
in as few keystrokes as possible.
-
So, this is challenge number 6 and
-
there is a one to ten in letters and a one to ten in numbers
-
and the goal is to get the one to ten lined up in two columns.
-
So the best score into Vim is 17, is the winning score.
-
So let's see if Emacs might do a little bit better.
-
Ok, I'll run through it one time without commentary
-
and then I'll run through it again and tell you what I'm doing.
-
So pay attention to the keystrokes.
-
Haha! Now wasn't that awesome.
-
Let's see it again in slow motion.
-
Ok, now we are back to the start.
-
This is the first episode where I use macros but it won't be the last!
-
Macros is a powerhorse in Emacs.
-
So I start by defining a macro pressing F3
-
then jump to the bottom and I delete all.
-
This puts it into the kill ring and I erase the space
-
and then I press Control-9
-
Control-9 doesn't do anything on it's own,
-
but it makes my next command repeat 9 times.
-
Which is command p for previous line, 9 lines up
-
Control-E, tab, yank, and my macro is finished.
-
So I press F4 to complete my macro and now
-
I can run that macro nine times, Control-9 F4.
-
Done.
-
And that was 12 keystrokes.
-
Let me remind tou, best in Vim, 17.
-
So, to reiterate
-
Emacs rocks!