On 07/13/2010 09:03 PM, nooj wrote:

Tim, Tony, and everyone -

One day I hope to remember those movement commands.  Alas, learning vi is
incremental...


I understand that recording macros is efficient, but I basically never do
it.  That's because I've learned to hate record mode, since I accidentally
end up in it all the time when I mistype ":q" (as "q:" or just "q").  I'm
trying to exit, and I end up at an ex command line, and for a while I didn't
know how to get OUT of record mode...  This happened for many years, since I
only used vi when programs popped vi as a default editor.  I learned to use
it out of self defense!

Dot "." I use almost as much as cursor movement.  I'm extremely familiar
with it and with the cursor movement comands, and I'd like to extend the
reach of . to include everything that happens during an insert-mode event
(typing, backspacing, arrow keys) if what it's repeating is an insert-mode
event.  Seems like there could be a flag to allow that.  (I'm vaguely aware
that arrow keys in insert mode are a little weird and that they begin new
insert-mode events or something.)

And to niggle a bit, Tony, your count of the keystrokes for a macro solution
to my problem is a little low in practice.  @<letter>  I count as 3
keystrokes, but the biggest underestimate comes when I do more than three or
four repetitions.  I have to physically COUNT the number of times I want to
repeat, and to do that I hit the down key that many times, counting them up,
and then I hit the up key to go back.  THEN I have to type in the number,
@q, and see if it worked.  About 25-30% of the time it doesn't (miscount,
mis-typed macro, whatever), and so I have to hit u, and repeat.  This
becomes FAR more keystrokes, far more thinking, and far more time than if I
just did one edit, one cursor movement sequence, and started hitting . until
I got to the end.

You're doing it wrong :-). Guess on the conservative side, let's say if
you see you need about 30-35 playbacks, do: 2...@q, then see how many are
left and do e.g.: 5@@. If you guessed very close, you can do @@ and then
hit '.' as needed. In my case, I have Q defined as mapping to do @q, so
  things are even easier. All in all this is one of the most indispensible
Vim commands in terms of how much work in can save you sometimes. I
can't remember how many times I'd have a few hundred lines to change and
I'd use a recording to change them in 10-15 seconds, including the time
to record.

BTW there's also a trick to visually select a block and run a recording
on all lines in it. I don't recall now how to do that but someone here
will know this if you need it.

    -ak

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to