Typing vim -x filename will prompt you for an encryption key. Enter a key, type your message and write it out to a file. When that file is opened up, the user will be prompted for the same key. If it’s not entered or entered incorrectly, then the file will be opened an shown in it’s encrypted form.
This is probably not the way you want to store your banking information, but it’s perfect for placing a file with a password in it in someone’s home directory so that they can log into whatever service you just setup for them. Enjoy.
NOTE: While you are editing the original message, the filename.swp file is not encrypted and is readable using vim -r .filename.swp, so be careful !




You can also turn on encryption with the X command. (use :help :X to see more info)
Definitely don’t store anything sensitive in the file, since the encryption algorithm is pretty weak.