On 13/07/10 07:22, nooj wrote:

Is there a way to repeat the last cursor movement?  Dot (.) repeats last
edit,
is there an analog for motion, so that, for example, if I press zj to
move down
a fold I can just hit some other key to repeat that?

You can always record macros, and bind a key to playback a macro.

This isn't as good.  Sometimes you want to repeat something only one or two
times, and recording the macro and playing it back can take more keystrokes
than repeating the movement would.  Instead, cleverly positioning the cursor
after an edit allows one to just keep hitting dot (.) for each repetition.

I used a version of vi/vim/gvim which did this, and I have no idea what
version it was or system it ran on.



Recording the macro means doing it once, plus a q and register letter before and a q afterwards i.e. n+3 keystrokes.

Replaying it once is @ <letter> i.e. 2 keystrokes

Replaying it 2 to 9 times is <digit> @ <letter> i.e. 3 keystrokes.

Replaying it 10 to 99 times is 4 keystrokes.

For this to be disadvantageous, your sequence to be repeated must be no more than 5 keystrokes if you do it twice (record once, replay once), no more than 3 if you do it three times, etc. For so short a sequence, you can afford to repeat it with no recording.

Hitting the dot repeats the last _change_ in Vim, not including ex-commands. Also the last yank if you are in 'compatible' mode (or if 'cpoptions' includes the y flag; but "repeating a yank" means that the text previously yanked is "forgotten" from the yank register — not very useful). @: repeats the last ex-command. n repeats the last search. Other than that, I don't think there's a built-in keystroke.


Best regards,
Tony.
--
   Arthur pulls Pin out.  The MONK blesses the grenade as ...
ARTHUR:  (quietly) One, two, five ...
GALAHAD: Three, sir!
ARTHUR:  Three.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--
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