Most modern editors support an undo stack, with undoing and replaying operations. Vim takes that one step further by introducing an undo tree. If you make a change, X, undo it, and then make a change, Y—Vim still saves the change, X. Vim supports manually browsing undo tree leaves, but there's a better way to do this.
Gundo is a plugin that visualizes the undo tree and is available from GitHub at: https://github.com/sjl/gundo.vim.git.
If you're using vim-plug to manage your plugins, add the following to your .vimrc file: Plug 'sjl/gundo.vim'. Execute :w | so $MYVIMRC | PlugInstall and you'll have Gundo installed and ready to go.
Let's say you're working on animal_farm.py, with your cursor on line 15:
You're editing the highlighted line: if kind == 'cat'. You perform the following operations:
- Replace...