This post is actually wrong on many accounts. For example, you'll find that M-Z followed by C-s is followed by immediate disappointment. It also does not save the macro or even do what the vim macro does (going to the beginning of the next line before starting the macro), which would cause it to fail catastrophically. The real sequence (based on this one) is this:
C-x (
M-z "
C-s (
C-b
C-b
C-k
Home
Down
C-x )
C-u 50 C-x e
I did two "C-b"s. I did that as more of a way to get out of the search mode quickly and lead into the next move. The first C-b could be an enter. The second C-b could be a left arrow, saving a keystroke but taking you off the main keyboard; however, I thought it would be nice to hold down the ctrl the whole time and just double-tap the b, so I will be keeping that in mind for keystroke count. Not that this is a problem in emacs... after all, you are having to hold down ctrl or meta throughout most of the process here, so you have to make stretches.
If we count holding down the ctrl and meta keys as characters/keystrokes (and we also need to count the shift key), we have a total of 29 keystrokes.
I would not personally use the C-u combo, though, for numbers. I just held down Meta. That reduces your keystrokes to 28.
And it is 27 if you use enter and left arrow instead of C-b C-b... the fingering is more awkward and arguably slower, but it will work (as opposed to the other NOT working) if you are not in highlight search mode.
I gave all the shortcuts I knew about (not retyping ctrl in silly places, etc), but all those shift keys and finger switches add up.
With vim, you will find that you do a lot less of this song and dance with modifiers.
His improved/correct vim macro, btw, is qqdf"t(Dj0q50@q which has a total count of 18, counting smart use of the shift key. The finger stretches are a lot shorter and the feel more natural. Try both combos as listed (I am using a 28 keystroker for feel), and you should see what I mean.
qqdf"t(Dj0q50@q
C-x ( M-z " C-s ( C-b C-b C-k Home Down C-x ) M-5 M-0 C-x e
In other words, there is additional value over just number of keystrokes.
Note... if 50 was the wrong guess at the number of lines, he does not have to type @q or @0 again to recall the last macro used. He can just type @@. This makes life much easier in an uncertain wall of text.
Edit: Parbo's suggestion of using function keys (which looks like only one macro can be used at a time) brings the emacs count down a little at the expense of flying to the top of your keyboard: -6 keystrokes, leaving us with about 22. Try that for feel as well:
qqdf"t(Dj0q50@q
F3 M-z " C-s ( C-b C-b C-k Home Down F4 M-5 M-0 C-x e
Yes, there's one character missing after M-z. I used M-z > to zap to the first > (and not to " like you did). I was not trying to do the same thing vim was doing; I was aiming to get the same result.
I didn't save the macro because I never save a macro if I'm only going to use it once, and it can be saved long after you finished it, provided you don't define another macro.
Also, the number of keys in not the only factor but the distance as well. For instance, Home and Down are located very far from the home row in my keyboard, so I always use C-a and C-e (and C-n and C-p). And they are surprisingly comfortable with the Dvorak layout I use ;-)
If we count holding down the ctrl and meta keys as characters/keystrokes (and we also need to count the shift key), we have a total of 29 keystrokes.
I would not personally use the C-u combo, though, for numbers. I just held down Meta. That reduces your keystrokes to 28.
And it is 27 if you use enter and left arrow instead of C-b C-b... the fingering is more awkward and arguably slower, but it will work (as opposed to the other NOT working) if you are not in highlight search mode.
I gave all the shortcuts I knew about (not retyping ctrl in silly places, etc), but all those shift keys and finger switches add up.
With vim, you will find that you do a lot less of this song and dance with modifiers.
His improved/correct vim macro, btw, is qqdf"t(Dj0q50@q which has a total count of 18, counting smart use of the shift key. The finger stretches are a lot shorter and the feel more natural. Try both combos as listed (I am using a 28 keystroker for feel), and you should see what I mean.
In other words, there is additional value over just number of keystrokes.Note... if 50 was the wrong guess at the number of lines, he does not have to type @q or @0 again to recall the last macro used. He can just type @@. This makes life much easier in an uncertain wall of text.
Edit: Parbo's suggestion of using function keys (which looks like only one macro can be used at a time) brings the emacs count down a little at the expense of flying to the top of your keyboard: -6 keystrokes, leaving us with about 22. Try that for feel as well: