repeat last command

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

repeat last command

Don Stefani
Hello,

How would I repeat the last command with out typing it again?
IE:...

:<<< (indent) ?

Thanks,

dstefani
Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

Sean Hubbell
Don Stefani wrote:

>Hello,
>
>How would I repeat the last command with out typing it again?
>IE:...
>
>:<<< (indent) ?
>
>Thanks,
>
>dstefani
>
>
>  
>
try .

That is, type a period.

Sean
Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

henrik-10
In reply to this post by Don Stefani
That is easy just type .

Life can be so easy sometimes :)))

Henrik


On Tue, 2005-08-09 at 09:46 -0700, Don Stefani wrote:

> Hello,
>
> How would I repeat the last command with out typing it again?
> IE:...
>
> :<<< (indent) ?
>
> Thanks,
>
> dstefani

Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

Aaron Griffin
In reply to this post by Don Stefani
:help single-repeat

On 8/9/05, Don Stefani <[hidden email]> wrote:

> Hello,
>
> How would I repeat the last command with out typing it again?
> IE:...
>
> :<<< (indent) ?
>
> Thanks,
>
> dstefani
>
Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

A.J.Mechelynck
In reply to this post by Sean Hubbell
----- Original Message -----
From: "Sean Hubbell" <[hidden email]>
To: "Don Stefani" <[hidden email]>
Cc: <[hidden email]>
Sent: Tuesday, August 09, 2005 6:01 PM
Subject: Re: repeat last command


> Don Stefani wrote:
>
>>Hello,
>>
>>How would I repeat the last command with out typing it again?
>>IE:...
>>
>>:<<< (indent) ?
>>
>>Thanks,
>>
>>dstefani
>>
>>
>>
> try .
>
> That is, type a period.
>
> Sean
>
>

A period will repeat the last Normal-mode _change_. It won't repeat
Ex-commands (those entered with : on the command-line), and by default it
will not repeat a yank command in 'nocompatible' mode, nor (IIUC) commands
that don't change the text (such as cursor moves). To repeat the latest
ex-command, hit <Up> after the colon (this will recall the latest ex-comand,
or the one before that each time you hit <Up> again) then hit <Enter> to
accept ot <Esc> to abort. If you type part of a command after the colon,
<Up> will only recall commands starting with what you typed. See also ":help
@:".

To repeat _any_ (sequence of) Normal-mode command(s), enter it into a
register (e.g. by hitting q<letter> before you start doing it the first
time, and q again to end recording). You can then repeat it by using
@<letter> (in both cases, <letter> is the name of the register, usually a
letter [a-z]). The repeat command may have a count, to repeat the same thing
several times.

HTH,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

Sean Hubbell
Given the original question:

Hello,

How would I repeat the last command with out typing it again?
IE:...

:<<< (indent) ?


The result of what he would like to accomplish is the '.' or single
repeat command. I do admire your attention to the language used when
asking the question thought Tony as you are right, but sometimes we have
to read in between the lines as we all have different perceptions.

Sean
Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

Tim Chase-2
In reply to this post by A.J.Mechelynck
> See also ":help @:".

Two caveats I've found regarding the use of "@:"

(*) if you type an Ex command and embed a carriage-return using
the control+V method, you'll get unexpected results, as it will
act as if you typed a carriage-return at that location, rather
than make it part of the Ex command

(*) similarly, if your previous Ex command was over a range, you
highlight a new range, and then try and use "@:" it will also
fail, as it will now have *two* ranges, in effect, trying to run
something like

        :'<,'>'<,'>g/stuff

which causes Vim to choke.  I'm not sure I'd consider either of
them a bug, per se, as I understand what they're doing.  However,
it's not quite the expected behavior

-tim





Reply | Threaded
Open this post in threaded view
|

Re: repeat last command

A.J.Mechelynck
----- Original Message -----
From: "Tim Chase" <[hidden email]>
To: "Tony Mechelynck" <[hidden email]>
Cc: "Don Stefani" <[hidden email]>; <[hidden email]>
Sent: Tuesday, August 09, 2005 8:00 PM
Subject: Re: repeat last command


>> See also ":help @:".
>
> Two caveats I've found regarding the use of "@:"
>
> (*) if you type an Ex command and embed a carriage-return using
> the control+V method, you'll get unexpected results, as it will
> act as if you typed a carriage-return at that location, rather
> than make it part of the Ex command
>
> (*) similarly, if your previous Ex command was over a range, you
> highlight a new range, and then try and use "@:" it will also
> fail, as it will now have *two* ranges, in effect, trying to run
> something like
>
> :'<,'>'<,'>g/stuff
>
> which causes Vim to choke.  I'm not sure I'd consider either of
> them a bug, per se, as I understand what they're doing.  However,
> it's not quite the expected behavior
>
> -tim

Thanks Tim, I don't use @: or type-and-repeat macros myself but some people
(such as the OP) might find them useful.

To make a slight change to a recorded sequence (let's say it was in register
x), edit it as text rather than retype it all:

    :new
    "xP
    <make the necessary edit by hand>
    "xyy                   (linewise), or
    A<Space><Esc>"xy<Home>   (characterwise, extra space because {motion}s
are "exclusive")
    :q!

Then you're back in the window you started from and you can use @x to repeat
the new version of the recorded sequence.


Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

RE: repeat last command

Keith W. Roberts
In reply to this post by Tim Chase-2
Hmmm, doesn't seem like it should be too tough a job for vim to strip
everything up to the 1st character before adding the new "range" when doing
@: from visual mode ...

-----Original Message-----
From: Tim Chase [mailto:[hidden email]]
Sent: Tuesday, August 09, 2005 11:01 AM
To: Tony Mechelynck
Cc: Don Stefani; [hidden email]
Subject: Re: repeat last command

> See also ":help @:".

Two caveats I've found regarding the use of "@:"

(*) if you type an Ex command and embed a carriage-return using
the control+V method, you'll get unexpected results, as it will
act as if you typed a carriage-return at that location, rather
than make it part of the Ex command

(*) similarly, if your previous Ex command was over a range, you
highlight a new range, and then try and use "@:" it will also
fail, as it will now have *two* ranges, in effect, trying to run
something like

        :'<,'>'<,'>g/stuff

which causes Vim to choke.  I'm not sure I'd consider either of
them a bug, per se, as I understand what they're doing.  However,
it's not quite the expected behavior

-tim