Vim can also be used to safely store information, by encrypting text files with different cryp
methods. To see the cryp
method that Vim is currently using, type:
:set cryptmethod?
We can see in our case it is zip
, which is not actually a crypto
method and does not offer much in terms of security. To see what different alternatives we have, we can type:
:h 'cryptmethod'
A page describing the different encryption methods comes up. We can choose from zip
, blowfish,
and blowfish2
.The most secure and recommended one is, of course, blowfish2
. To change the encryption method, type:
:set cryptmethod=blowfish2
This can be also added to vimrc
so that it becomes the default encryption. Now we can safely encrypt files using Vim.
A common scenario would be storing a passwords file.
Let's open up a new file named passwords.txt
, add some dummy passwords inside, and save it. The next step is to encrypt the file with a password, and for this we type :X
.
Vim will prompt you for a password twice...