Step 2 of 5

7. Undo And Redo

Redo

What good is undo without its trusty companion redo?

You can redo in Vim using <C-r> in normal mode — that is, hold control on your keyboard and hit r.

Redo is exactly what it says on the tin — it takes you in the opposite direction to undo, toward your more recent edits.

Work through the checklist below to take a round trip through the undo history: delete a line, undo the deletion, then redo it with <C-r>.

  1. Delete the DELETE ME line The cursor starts on it — press dd.
  2. Bring the line back with undo The deleted line will reappear — press u.
  3. Redo the deletion The line disappears all over again — hold control and hit r.
Delete the DELETE ME line The cursor starts on it — press dd.

Next: Bring the line back with undo

Loading editor…