6

Is there a way to open a GnuPG encrypted file with neovim so that one can read/edit it and on write the file is re-encrypted?

This is possible via vim-gnupg in classic vim but has not been ported to neovim. I cannot use the gpg-agent hack as I do not have X11 installed on the remote machine I wish to use this on.

5
  • As a workaround - have you tried using gpg-agent as suggested by tarruda (NeoVim author) in that thread from Github you linked?
    – grodzik
    Nov 16, 2016 at 8:55
  • @dotancohen: Thank you for your bounty! Much appreciated. Nov 16, 2016 at 9:05
  • @grodzik I have missed your comment when you made it: no, i cannot use it as I do not have X11 installed on the server I wish to use this on. May 18, 2017 at 14:45
  • Why would you need X11 for that? if for pinentry - then there's a curses-based one as well.
    – grodzik
    May 18, 2017 at 14:53
  • 2
    @grodzik Because Neovim runs external commands attached to a pipe, instead of attached to the tty as Vim did. This makes interacting with the pinentry problematic, to say the least. If you set shellpipe in Vim, you'll see similar problems. I've been contemplating whether it would be better to write a new plugin for neovim, since the current one would need a fair amount of refactoring to work nicely with neovim.
    – jamessan
    May 18, 2017 at 17:19

1 Answer 1

4
+50

I did a little research and it seems that the only option right now is the one mentioned by @grodzik: you need to configure gpg-agent. Quoting Thiago de Arruda (Neovim lead developer):

I'm a long time vim-gnupg user and have been using it with neovim since day 1. I never had problems because I use gpg-agent which by defaults displays a x11 prompt to get the password (the GPG_TTY warning can be safely ignored).

In the same thread the vim-pgp author has shared his progress on making the plug-in compatible with Neovim. I think it will take a while but lately he has been contributing to Neovim (in fact the last Neovim commit is authored by him) so it's just matter of time.

1
  • I encrypted a file in vim 8.1.3741 but nvim v0.6.1 cannot open and decrypt it.
    – Stephane
    Apr 4, 2022 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.