Recover .swp file in vi

I was just editing a file in vi on my iPad using diet coda. Hadn’t saved it and the app crashed. Boo.

Tried to open the .swp file, oops, don’t do that.

Instead, use:

[code]vi -r file[/code]

Open the file as if it existed, but using the -r flag (recover, suprisingly) vi will look for the .swp file and make it all better.

Then just save it as usual.

Posted in: vi

Leave a Reply

Your email address will not be published. Required fields are marked *