Reputation: 650
Encrypted a file in vim using :X
. I opened the file and entered a wrong key, it showed garbage. Then I tried to turn off encryption by executing the following in command mode :set key=
. Now i'm not able to decrypt the file.
I have encrypted my file so that nobody reads it. If someone try to access the file with wrong key and then execute :set key=
, then how to get back my original file?
Upvotes: 0
Views: 388
Reputation: 172698
A way to re-try encryption key entry after a wrong attempt is via unloading and re-editing the file:
:bdelete | edit #
If you have written the (garbled) buffer after :set key=
, the contents may have been lost, as you have persisted (now unencrypted) the garbage. You can check by attempting a re-edit or looking at the file contents; it should start with VimCrypt~
.
Upvotes: 1