Editing GPG encrypted files symmetrically in NeoVIM
Copy plugin/gpg.lua file to your ~/.config/nvim/lua/plugins/ directory
-- ~/.config/nvim/lua/plugins/gpg.lua
{
"benoror/gpg.nvim",
ft = { "gpg", "asc", "pgp" },
}-- ~/.config/nvim/init.lua
vim.pack.add({
{ "https://github.com/benoror/gpg.nvim" },
})vim.filetype.add({
extension = {
gpg = "gpg",
asc = "asc",
},
})
return {
"benoror/gpg.nvim",
ft = { "gpg", "asc", "pgp" },
}Vía @Frestein Frestein/dotfiles/dot_config/nvim/lua/plugins/extras/utils/gpg.lua
gpg- Optional:
pinentry-mac
All *.gpg files will be symmetrically decrypted/encrypted transparently using gpg tools
This plugin can update the GPG agent startup TTY (equivalent to
gpg-connect-agent updatestartuptty /bye) to keep pinentry-curses attached
to the current terminal. To enable it:
vim.g.gpg_update_tty = trueIf you still see input issues with pinentry-curses, you can enable an
optional "priming" step that runs gpg --list-packets on the file before
decrypting so the passphrase is cached by the agent:
vim.g.gpg_prime_agent = trueLocal smoke tests (headless Neovim, temp keyring):
make test-bash
make test-zsh
make test-nuPlugin manager compatibility checks:
make test-lazy
make test-packerNotes:
- The tests create a temporary
GNUPGHOMEand a throwaway key, so your user keyring is not touched. - The tests also set isolated
XDG_*paths andNVIM_APPNAMEto a temp directory to avoid writing artifacts into your normal Neovim runtime. tests/init_lazy.luaandtests/init_packer.luawill clone their managers if missing (network required).
- From @nickali https://gist.github.com/nickali/89f3743e305db015d0f3ad4ffd325ccb
- Proposed first by @traut https://gist.github.com/traut/cd19ae2817ab13e0bade1f8a9995029f
