When editing text and making changes to a vi file, there will no doubt be times when you'll wish that you had not changed something. vi's undo commands allow you to back up one operation and continue on from there.
If you make a mistake in vi or if you just change your mind once an operation is completed, you can undo your last command by pressing u immediately after the command. (There's no need to press Esc after typing u.) Pressing u a second time undoes the undo.