Vim has a lot of useful registers from which you can access the contents of various actions. There's ": for the last command in the command line, "/ for the last search, ". for the last insert, etc...

Is there a register that stores the last action performed (i.e. what gets done when I press .)?

  • Unfortunately, no... 😔
    – filbranden
    Jun 15, 2021 at 14:56
  • @filbranden RIP. You can leave that as an answer. I'll leave it for a few days to see if someone protests. If not, I'll accept it. Jun 15, 2021 at 15:02
  • 1
    I think this is actually a duplicate vi.stackexchange.com/q/13429 or vi.stackexchange.com/q/15713
    – statox
    Jun 15, 2021 at 15:33
  • @statox I don't think it is. My question is not about editing it, neither about an alternative method to save the last action. It's specifically about the existence of a built-in register that automatically stores the contents of the . command. I think it's best to keep these links however, as the questions are related. Jun 15, 2021 at 15:42
  • 1
    Using a register for this would actually be somewhat difficult, as registers are always global and the . is local to the buffer; it would have to introduce the concept of buffer-local registers. I think a function to access this would be better. Jun 18, 2021 at 4:43

1 Answer 1


To quote filbranden's comment:

Unfortunately, no... 😔

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.