Recently I had to compile a latex file a few times, :!pdflatex filename.tex did the trick. But is there a way in normal mode to repeat commands like these which are in the recent history,but used repeatedly for a short time.

Setting keybinding to for :command is not what I am looking for, since the command is used only for a short time.

  • 3
    See :help @:. Is that what you mean?
    – Ralf
    Commented Mar 13, 2019 at 20:23
  • Yes, thats what I was looking for. I did'nt know that these special registers existed for recording also.
    – GGJON
    Commented Mar 14, 2019 at 7:25

1 Answer 1


As Ralf mentions in the comments, the : register always contains the last colon command.

So, @: will replay the last command, and @@ should work after that.

In addition, you can :<Up> for command line history, or use q: for the command line window.

  • 1
    Also: If you enter :!p<Up> it will only fetch commands from the history, that begin with !p.
    – Ralf
    Commented Mar 14, 2019 at 8:18

Your Answer

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

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