When you make a change, like ifooESC to insert the text foo, this can, of course, be repeated using ..

However, if you quit Vim, in spite of Vim saving all sorts of state, including the contents of registers and per-file editing position and the : command history, this last edit seems to be lost. When you fire up Vim again, you cannot repeat the command.

Is there some trick to get that persisted into .viminfo, so we can type ifooESC, then quit with :q!, up Vim again, and repeat the insert of foo with .?

  • 2
    It doesn't look like there's a way to do that... In fact, I don't think you can even inspect what the . command will do, since there's no register or function exporting that information... It might be a good idea to propose adding a function that exposes it (and maybe allows setting it?) though not sure it right now it's stored as a sequence of Vim commands, it might be stored in a different format inside Vim itself...
    – filbranden
    Commented Jun 2, 2021 at 22:14
  • 1
    There is the dot register, I think, but it may be for something else (last inserted text?)
    – D. Ben Knoble
    Commented Jun 2, 2021 at 23:34


Your Answer

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

Browse other questions tagged or ask your own question.