created 2002 · complexity basic · author Prakash Patil · version 6.0
This tip is deprecated for the following reasons:
Encryption in Vim has improved drastically since this tip was written, with a blowfish (and blowfish2) cryptmethod, and encryption of some of the supporting files. This renders many of the comments obsolete, but also the tip needs updating for the new options to make sure you're using good secure values.
I was desperately looking for a simple way to encrypt files.
I find this very useful. Despite all the user permissions you set, it's easy for someone/admin to do sudo and read your personal files..Many work environments provide users the permission to sudo or become super user.
Vim lets you encrypt file within the edit session.
Will prompt for encryption key. Enter the encryption key and REMEMBER to save it using :w. That will encrypt the file.
If you don't want to leave behind traces of your edits, note the following.
By default, once you finish your vim session, ~/.viminfo will be written with the files you edited (marks), commands you entered and possibly what you wrote (the registers you copied or pasted...). If you don't want such trace to be left behind, then place the following file in in your vimrc: