Sometimes, when editing a file, you may delete a wrong line or change your mind about an edit, and you’ll want to revert the changes. This article explains how to undo and redo changes in Vim / Vi. Either Vi or Vim is installed by default on macOS and almost all Linux distributions. Knowing the basics of Vim might be very useful when you encounter a situation where your favorite editor is not available.