The other day, I discovered that vim has an “encryption” mode. In this mode, your file is encrypted whenever it is written to disk, and decrypted whenever it’s read back (this also applies to any temporary swap files).