$ vim -x filename
The -x option uses encryption when writing the file. It will ask for a key:
Enter encryption key: ******
Enter same key again: ******
From then on your filename will be encrypted and accessed using the password. The -x option will no longer be necessary when editing the file.
Didn’t know that one. Nice!