Too often do I make the mistake of typing with the wrong window focused (and have done so a few times with a USB authenticator). In programs with lots of hotkeys enabled (Gmail, VLC, Vim), this often has the unintended consequence of making unwanted modifications.
I can sometimes trace my steps and remember what I have typed to repair any changes or revert any settings that I tweaked if I catch myself early. Unfortunately, that is not always the case.
In Vim, I could have something as innocuous and apparent as altering a line of text which is easily undone. Or, I could have unknowingly modified something not so easily identified. If I accidentally type a sequence of unwanted commands in Vim, how can I check for and undo any edits or changes to settings?
:e!
would do that:e!
would be bad if you haven't saved since the last correct state, andu
might be insufficient if you typed a bunch of stuff. (If you typeddate month
, for example, then you would have deleted a tag, set a mark, and performed a search, which would be quite confusing to undo viau
.)u
being part of the sequence, performing some undos in the middle.