Configuring Vim Undotree.
To enable persistent undo and configure the undotree plugin, add the following settings to your vimrc file:
" Save undo trees in files
set undofile
set undodir=~/.vim/undo
" Number of undo levels saved
set undolevels=10000
For more information on intermediate Vim usage, see this guide.