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 Mar 13 '19 at 20:23
  • Yes, thats what I was looking for. I did'nt know that these special registers existed for recording also. – GGJON Mar 14 '19 at 7:25

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.

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

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.