gpg.nvim
February 8, 2026 · View on GitHub
gpg.nvim
Editing GPG encrypted files symmetrically in NeoVIM
Install
Manually
Copy plugin/gpg.lua file to your ~/.config/nvim/lua/plugins/ directory
Using
lazy.nvim
-- ~/.config/nvim/lua/plugins/gpg.lua
{
"benoror/gpg.nvim",
ft = { "gpg", "asc", "pgp" },
}
vim.pack
-- ~/.config/nvim/init.lua
vim.pack.add({
{ "https://github.com/benoror/gpg.nvim" },
})
Config
Customize file extensions
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
Requirements
gpg- Optional:
pinentry-mac
Usage
All *.gpg files will be symmetrically decrypted/encrypted transparently using gpg tools
GPG agent TTY handling
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 = true
If 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 = true
Testing
Local smoke tests (headless Neovim, temp keyring):
make test-bash
make test-zsh
make test-nu
Plugin manager compatibility checks:
make test-lazy
make test-packer
Notes:
- 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).
Credits
Based off
- From @nickali https://gist.github.com/nickali/89f3743e305db015d0f3ad4ffd325ccb
- Proposed first by @traut https://gist.github.com/traut/cd19ae2817ab13e0bade1f8a9995029f
Inspired by
https://github.com/jamessan/vim-gnupg