You've deleted the wrong text and you want to get it back.
There are several ways to recover deleted text.
If you've just deleted something and you realize you want it back,
to undo the last command (for example, a
This works only if you haven't given any further commands, since
only undoes the most recent command.
On the other hand,
will restore the line to its pristine state; the way it
was before any
changes were applied to it.
You can still recover a recent deletion, however, by using the
command, since vi
saves the last nine deletions in nine numbered deletion
If you know, for example, that the third deletion back is the one you want to
to "put" the contents of buffer number 3 on the line below the
cursor. This works only for a deleted line
Words, or a portion of a line, are not saved in a buffer.
If you want to restore a deleted word or line fragment, and
won't work, use the
command by itself. This restores whatever you've last deleted.