0

To get the most recent command I can do:

:<ctrl-p>

Or:

:<up>

However, this will also show commands that might have been typed in, but weren't run, for example, I may recently typed in:

:call TypoFuNCt

But not actually executed it. And then if I go back and press us, it will fill in that last-entered text. Is there a way to skip not-entered-commands in the ctrl-n/p or elsewhere?

3

The last typed & executed command is stored in the "colon"-register (:h quote:). You can input its value while editing the command-line by pressing Ctrl-R: (:h c_CTRL-R).

Or you can just re-run this command by typing :@: in the command-line.

| improve this answer | |
  • Do you need the first colon? I think bare @: will do the trick – D. Ben Knoble Jun 27 at 13:00
  • @D.BenKnoble You mean @: in Normal mode? Yes, and this one too. Just not sure if the OP wants a Normal mode command as well. – Matt Jun 27 at 13:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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