vi/vim editor FAQ: How do I undo and redo changes in the vi and vim editor?
Here are a couple of quick examples of how to undo and redo ("re-do") recent changes in your vi/vim editor sessions.
vim undo - how to undo a change in vi/vim
You "undo" changes in vi and vim with the undo command, which is the "u" key when you are in vim command mode. For instance, if you start with this text in your editor: