If the power fails, or your computer crashes, any file you were editing probably won't be saved. However, when the computer is restarted, you should be able to recover the file by typing:
vim -r <filename>
where <filename> is the name of the file you were editing at the time of the crash.
If you were editing without a file name, enter:
vim -r ""
You can list the recoverable files:
Each of these commands should be executed in the directory where you were when the crash occurred.