If you’ve been a long time reader of this blog you know I’m all about encryption. I still have a lot to learn about it, but I like to use it whenever I can. Encrypting emails. Encrypting network traffic, and with vim, encrypting documents.
From the man page:
Use encryption when writing files. Will prompt for a crypt key.
To encrypt a document with vim open the new or existing file with:
vim -x [file]
This will prompt you for a passphrase, and only apply the encryption when writing a file. ie; if you don’t save it or ‘w’rite the file it won’t be applied. Use any passphrase you like and the file will be encrypted to that string. Anytime you open the file after this, even using the normal open method (vim [file]) it will prompt for the password before showing any file contents.
Enjoy a bit more privacy on your machine, and easily encrypt your files with vim.