Listing All Undo Branches
After undo, we do some more changes and overwrite the last done changes with current changes. Generally, there is no way to access those removed changes but in Vim, these changes are not completely deleted but instead, their entries get branched into different undo branches. We can view and access these branches using the following command:
:undolist
Example
How to undo in Vim editor in Linux
Vim (short for Vi Improvised) is a popular text editor mainly used in Linux and Unix-based operating systems but due to having a CLI (command line interface), it might be difficult for new users to make use of basic features such as undo in Vim. So in this article, we will learn different ways and types to undo changes in Vim Editor in Linux.
Like all other modern text editors, Vim also has the functionality UNDO which enables the users to revert the changes done in the document. It saves the changes as revisions or entries in the memory so that when asked, it can revert the current revision to the previous revision.( basically undoing changes).
Vim has also a criterion of what is to be considered an entry or revision. Any of the following can be considered an entry:
- Pressing i to move into insert mode.
- Writing 4 new lines in insert mode.
- Editing 4 different lines in insert mode.