Vim Tips Wiki

Recover overwritten file

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 286 Printable Monobook Previous Next

created 2002 · complexity basic · author Little Dragon · version 5.7

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:


This command only works if you have a swap file. If you do not have a swap file, the recover command will not work.


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki