5

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 .)?

Luiz Martins
  • 457
  • 2
  • 9
  • Unfortunately, no... – filbranden Jun 15 '21 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. – Luiz Martins Jun 15 '21 at 15:02
  • 1
    I think this is actually a duplicate https://vi.stackexchange.com/q/13429 or https://vi.stackexchange.com/q/15713 – statox Jun 15 '21 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. – Luiz Martins Jun 15 '21 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. – Martin Tournoij Jun 18 '21 at 04:43

1 Answers1

0

To quote filbranden's comment:

Unfortunately, no...

Luiz Martins
  • 457
  • 2
  • 9