Educating yourself does not mean that you were stupid in the first place; it means that you are intelligent enough to know that there is plenty left to 'learn'. -Melanie Joy

Sunday 27 July 2014

Encrypt files using Vim

July 27, 2014 Posted by Dinesh , , , , , No comments

Vim comes with default encryption mechanism refereed as VimCrypt in the documentation. It is capable of writing files encrypted and read them back.

Creating new encrypted file:

vim -x <file>

This will create new file if it is not exist or open an existing file and prompt for password. This password is used as key to encrypt and decrypt the file.

Encrypt the current working file:

:X

You can also encrypt the current working file /open files using :X  option. This will also prompt for password. The typed password is stored in the 'key' option which is used to encrypt the file when it is written.

Disable the encryption:

To disable the encryption reset the 'key' option to empty value. To do this you first need to open the file with proper password.

:set key=




0 comments:

Post a Comment