Tip: #286 - Recover overwritten file
Created: July 23, 2002 1:07 Complexity: basic Author: Little Dragon Version: 5.7 Karma: 160/53 Imported from: Tip#286
I was once editing a file and wanted to test something. The test was meant to add a line at the end of the file, from outside vim. All was fine, but instead of >> to append the output to the file, I wrote > to replace the file with the output by mistake.
If you happen to do something like that, the solution is:
:recover
Note: this command only works if you have a swap file. If you do not have a swap file, the recover command will not work.