Friday, January 29, 2010

Re: Restoring contents

> I had typed .wq! instead wq! while saving and closing the file
> in vim.All the contents i had in my file had got lost.Kindly
> let me know how can I retreive the contents of the file.Thanks
> in Advance.Help me in this as the file contained important
> information.

I'm afraid you don't make much sense here: if you actually typed
".wq!", then the file would have been written to disk. If you
meant to write "I had typed :q! instead of :wq!", then you may be
a bit out of luck because the "!" is interpreted as "and I mean
it because I know what I'm doing, even if that involves
abandoning my changes". Vim trusts you to know what you're doing
if you say you do.

You best bet would be

1) copy your viminfo to a safe archive

2) if you have an undelete utility, try to undelete the
associated .swp file for your file. You may or may not have
success with this. If you undelete it, and restart vim on the
file with the "-r"ecover option, it may offer you the ability to
recover as much as it has available.

3) if #2 didn't work, take a look in your archived viminfo file
to see if any salvageable information was stashed there (possibly
in stored registers). This won't get you the complete document,
but if you happened to do something that involved
yanking/deleting a large block of text, at least that portion
could be redeemed.


Otherwise, consider it a lesson in typing what you mean. Just
like in any other program, if using the Quit option prompts you
(which regularly using ":q" sans-exclamation-point would remind
you, a good habit to acquire) to save and you decline (by
specifying "!" in Vim), it's your own fault.

-tim

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: