A Neovim plugin to encrypt and decrypt buffers with ccrypt.
ccrypt is like AES and is based on the Rijndael cypher, and uses a 256-bit block size:
- Project page: ccrypt
You must have ccrypt installed and it must be in your path.
Install the plugin with your package manager:
{
"fouladi/ccrypt-wrapper.nvim",
config = function()
require("ccrypt-wrapper").setup({})
end,
}After setup, the following commands will be automatically applied.
The commands :Encrypt and :Decrypt are defined to call ccrypt for
encrypting and decrypting the buffer.
The commands :EncryptFile and :DecryptFile call ccrypt to encrypt
and decrypting whole file.
Encrypts buffer content using ccrypt with a password.
Decrypts buffer content using ccrypt with a password.
Encrypts the currently open buffer file using ccrypt.
- Prompts the user to enter and confirm an encryption password.
- Checks if the buffer is named and non-empty.
- Writes the buffer to disk.
- Prompts for confirmation if the target file (
<file>.cpt) already exists. - Uses
ccryptto encrypt the file, which automatically appends.cpt. - Deletes the original unencrypted file after successful encryption.
- Opens the encrypted file in the current buffer.
Decrypts the currently open .cpt file using ccrypt.
- Prompts the user to enter the decryption password.
- Validates that the current file has a
.cptextension. - Writes the buffer to disk (to ensure content is current).
- Uses
ccryptto decrypt the file in-place. - Automatically opens the decrypted file (with
.cptremoved) in the buffer.
If you have not installed ccrypt, you will receive this error message
when you call up the above functions:
Error: ccrypt is not installed.
