OpenWindows Advanced User's Guide

6.5.4 Undoing Changes

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. Undoing the Previous Command

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. Undoing Changes to a Line

Type U to undo all changes you've made to a line. This command works only if you haven't moved the cursor off the line. (There's no need to press Esc after typing U.)