Jason Seney has a simple, yet vey effective, way to encrypt files on the fly using GPG and Vim. The beauty of the method is that plain text never touches the disk or the swap file. It’s a neat trick and a good one to have when you are in the field.
To Open an Encrypted File (from shell):
gpg -d myfile.mkdn.gpg | vim - -n -i "NONE" "+set filetype=markdown"
To Encrypt and Save a File (from vim):
:w !gpg -c -o myfile.mkdn.gpg