Reputation: 9742
I was smart enough to run the dG
command in vim and instead of simply quitting my muscle memory put in a :wq
.
Is there any way to restore the file?
Upvotes: 0
Views: 245
Reputation: 196826
d<motion>
cuts the text covered by <motion>
into the unnamed register, "
. Assuming you have a relatively "normal" setup, Vim should have written the content of that register to ~/.viminfo
when you did :wq
. If so, you should be able to edit the same file and put the content of that register back into the buffer.
Edit your file in a new Vim session:
$ vim filename
The buffer should be empty.
Inspect the content of every register with :registers
to see if it is still stored. If you didn't use Vim in the mean time, register "
should have it.
If it is there, do the following, starting from normal mode:
v " start visual mode
"<name of register>p " put from register <name of register>
Upvotes: 2