benoror/gpg.nvim

website github github
terminal-integration
stars 21
issues 1
subscribers 2
forks 3
CREATED

UPDATED


gpg.nvim

Editing GPG encrypted files symmetrically in NeoVIM

Demo

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 GNUPGHOME and a throwaway key, so your user keyring is not touched.
  • The tests also set isolated XDG_* paths and NVIM_APPNAME to a temp directory to avoid writing artifacts into your normal Neovim runtime.
  • tests/init_lazy.lua and tests/init_packer.lua will clone their managers if missing (network required).

Credits

Based off

Inspired by

https://github.com/jamessan/vim-gnupg

Further reading