How can I undo and redo changes in vi?

Using vi, it's very easy to undo any number of changes you have made.  Make sure you are not editing (hit Esc), and hit the u.  This un-does the last change you made (in edit mode).  Repeating the u will continue to backtrack your changes. 

If you undo too many times, use cntrl-R will redo the last change you undid.  Again you can keep doing over and over.