Being able to delete large blocks of text at a single bound is all very well and good, but what if you mistakenly delete 53 lines that you need? There's a way to recover any of your past nine deletions, because they're saved in numbered buffers. The last delete is saved in buffer 1, the second-to-last in buffer 2, and so on.
To recover a deletion, type
<"> (the double quote character),
buffered text by number, then give the put command.
To recover your second-to-last deletion from buffer 2, type:
The deletion in buffer 2 is placed on the line below the cursor.
If you're not sure which buffer contains the deletion you want to
restore, you don't have to keep typing
and over again.
If you use the repeat command (
(undo), it automatically increments the buffer number.
As a result, you can search through the numbered buffers as follows:
to put the contents of each succeeding buffer in the file
one after the other.
Each time you type
u, the restored text is removed; when
you type a dot (.), the contents of the next buffer is restored to
u and . until you've recovered the text
you're looking for.
- from O'Reilly & Associates' Learning the vi Editor, Chapter 4