I just discovered this great feature of Vi. Previously, I was managing sensitive information by using shell scripts which decrypted PGP encrypted files and piped the output to Vi. It then reencrypted the data and overwrote the originals if I had made any changes.
It seems that Vim has a built-in function to encrypt files. Though the encryption isn’t nearly as strong as PGP, it’s better than simply storing sensitive information in plain text files.
Simply starting vim with “vi -x <filename>” will mark the data for encryption and prompt for a new key. Encryption can also be set on an open file with “:X“. Nifty.