Repeat last movement

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Repeat last movement

Bruce Woodward
Hi,

Is there a way to repeat last the movement? i.e. if I type in 5j to move down 5 lines and then want to repeat that move.
I know that I can repeat the last insert with . and I can repeat the last search forward with ; but how about the last movement?
If not, is the last movement command stored somewhere so that a script can be written?

cheers,
Bruce.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Repeat last movement

Tony Mechelynck

Bruce Woodward wrote:

> Hi,
>
> Is there a way to repeat last the movement? i.e. if I type in 5j to move
> down 5 lines and then want to repeat that move.
> I know that I can repeat the last insert with . and I can repeat the
> last search forward with ; but how about the last movement?
> If not, is the last movement command stored somewhere so that a script
> can be written?
>
> cheers,
> Bruce.

Not that I know of; but what you can do is record a number of keystokes in a
register and repeat that: e.g.

        qz5jq moves 5 lines down and stores 5j in register z

        @z replay the contents of register z (move down 5 lines)

        7@z replay register z seven times (move 35 lines down)

see
        :help q
        :help @


Best regards,
Tony.
--
methionylglutaminylarginyltyrosylglutamylserylleucylphenylalanylalanylglutamin-
ylleucyllysylglutamylarginyllysylglutamylglycylalanylphenylalanylvalylprolyl-
phenylalanylvalylthreonylleucylglycylaspartylprolylglycylisoleucylglutamylglu-
taminylserylleucyllysylisoleucylaspartylthreonylleucylisoleucylglutamylalanyl-
glycylalanylaspartylalanylleucylglutamylleucylglycylisoleucylprolylphenylala-
nylserylaspartylprolylleucylalanylaspartylglycylprolylthreonylisoleucylgluta-
minylasparaginylalanylthreonylleucylarginylalanylphenylalanylalanylalanylgly-
cylvalylthreonylprolylalanylglutaminylcysteinylphenylalanylglutamylmethionyl-
leucylalanylleucylisoleucylarginylglutaminyllysylhistidylprolylthreonylisoleu-
cylprolylisoleucylglycylleucylleucylmethionyltyrosylalanylasparaginylleucylva-
lylphenylalanylasparaginyllysylglycylisoleucylaspartylglutamylphenylalanyltyro-
sylalanylglutaminylcysteinylglutamyllysylvalylglycylvalylaspartylserylvalylleu-
cylvalylalanylaspartylvalylprolylvalylglutaminylglutamylserylalanylprolylphe-
nylalanylarginylglutaminylalanylalanylleucylarginylhistidylasparaginylvalylala-
nylprolylisoleucylphenylalanylisoleucylcysteinylprolylprolylaspartylalanylas-
partylaspartylaspartylleucylleucylarginylglutaminylisoleucylalanylseryltyrosyl-
glycylarginylglycyltyrosylthreonyltyrosylleucylleucylserylarginylalanylglycyl-
valylthreonylglycylalanylglutamylasparaginylarginylalanylalanylleucylprolylleu-
cylasparaginylhistidylleucylvalylalanyllysylleucyllysylglutamyltyrosylasparagi-
nylalanylalanylprolylprolylleucylglutaminylglycylphenylalanylglycylisoleucylse-
rylalanylprolylaspartylglutaminylvalyllysylalanylalanylisoleucylaspartylalanyl-
glycylalanylalanylglycylalanylisoleucylserylglycylserylalanylisoleucylvalylly-
sylisoleucylisoleucylglutamylglutaminylhistidylasparaginylisoleucylglutamylpro-
lylglutamyllysylmethionylleucylalanylalanylleucyllysylvalylphenylalanylvalyl-
glutaminylprolylmethionyllysylalanylalanylthreonylarginylserine, n.:
        The chemical name for tryptophan synthetase A protein, a
        1,913-letter enzyme with 267 amino acids.
                -- Mrs. Bryne's Dictionary of Unusual, Obscure, and

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Reply | Threaded
Open this post in threaded view
|

Re: Repeat last movement

gmguyx

I don't know if there are still plans to implement this in vim, but it
looks like it was on Bram Moolenaar's to do list back in 2000
according to this post I found through google:

http://marc.info/?l=vim&m=97025236830713&w=4

Repeating a previous movement command is somewhere in the todo list.
The idea
is that you can repeat a specific command.  For example, repeat the
last "c"
command would repeat "cw", also when it was followed by a "dd".  The
same can
be done for a movement command.

The main problem with this kind of clever repeating is that the repeat
command
will probably be longer than the original command...

On Jul 23, 9:44 pm, Tony Mechelynck <[hidden email]>
wrote:

> Bruce Woodward wrote:
> > Hi,
>
> > Is there a way to repeat last the movement? i.e. if I type in 5j to move
> > down 5 lines and then want to repeat that move.
> > I know that I can repeat the last insert with . and I can repeat the
> > last search forward with ; but how about the last movement?
> > If not, is the last movement command stored somewhere so that a script
> > can be written?
>
> > cheers,
> > Bruce.
>
> Not that I know of; but what you can do is record a number of keystokes in a
> register and repeat that: e.g.
>
>         qz5jq           moves 5 lines down and stores 5j in register z
>
>         @z              replay the contents of register z (move down 5 lines)
>
>         7@z             replay register z seven times (move 35 lines down)
>
> see
>         :help q
>         :help @
>
> Best regards,
> Tony.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---