7

I'm looking for something like . or @@ that will work in normal mode for repeating the last Ex-mode command.

As per the rule of the XY problem, I'll also state the broader goal:

I have a fancy regex search and replace command in Ex-mode that I want to apply to almost all matches in the file. But I need to review each one before I change it. If I could use . to repeat an Ex-mode command, I could just use n and . to do what I need.

So any way to apply my search and replace to all lines interactively would help me—but I'd still be interested in an answer to the title question.

1 Answer 1

7

Use the /c flag at the end of your substitution in order to confirm each substitution:

:%s/foo/bar/gc

See :help s_flags.

Use & to repeat the last substitution without the flags. See :help &.

Use @: to repeat the last ex command.

1
  • Perfect. Everything I asked for. :)
    – Wildcard
    Oct 18, 2015 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.