1

I want to edit a GPG encrypted file file.asc without having to split the window to enter the recipient.

The recipient can be set in the vimrc.

:let g:GPGDefaultRecipients='<key ID>'

How would you suggest to parametrize/modify the gnupg plugin to automatically set the right recipient?

5
  • @grochmal It's not uncommon to encrypt to yourself and others. It's more common with mail, but also happens in other circumstances so I wouldn't say you're probably doing it wrong.
    – jamessan
    Apr 2 '17 at 2:58
  • @jamessan - but, if you are encrypting for others, you wouldn't be able to decrypt it anyway (and therefore not able to edit), right? That's how I understand pubkey cypto at least. Or I'm simply missing that gnupg-vim uses symmetric enc for files? Sorry for that if it is the case. Yet, for symmeric enc Vim has blowfish built-in.
    – grochmal
    Apr 2 '17 at 4:10
  • @grochmal You can specify multiple recipients with asymmetric encryption. That's how it works for email. If you couldn't encrypt it to yourself + the recipient, then you wouldn't be able to read it. vim-gnupg also supports symmetric encryption.
    – jamessan
    Apr 2 '17 at 4:32
  • @jamessan - god, yeah. I completely forgot that trick (encrypt to someone and yourself, so you can edit as long a s you have your key and someone's pubkey). I feel stupid now. Removed the (quite bad) first comment. Thanks for that.
    – grochmal
    Apr 2 '17 at 14:57
  • @user123456 You shouldn't have to manually open the recipient dialog. When you open a new file that matches the "encrypted file" pattern, it will automatically run the recipients dialog. Just enter the recipients there and then close the window.
    – jamessan
    Apr 2 '17 at 23:27
1

I'd better create an "empty" GPG encrypted file with the proper recipient and open it.

echo ""  | gpg -a -e -r <GPG ID/mail> > doc.asc
vim doc.asc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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