Menu
blog.headdesk.me
blog.headdesk.me

Edit gpg encrypted file with vim

Posted on 2022/12/162022/12/16

Working with encrypted files can be troublesome at times. Thanks to James McCoy, there is a plugin for vim that makes the task so much easier.

Vim supports encryption with the -x switch. At time of writing, blowfish2 symmetric encryption is only encryption available. That means a password needs to be set for every file. I use gpg to encrypt files with asymmetric keys. With the vim-gnupg plugin, I can seamlessly edit encrypted files. Here is how.

Download the plugin from https://www.vim.org/scripts/script.php?script_id=3645. Unzip the file in ~/.vim/pack/vendor/start

wget -O /tmp/vim-gnupg.zip https://www.vim.org/scripts/download_script.php?src_id=27359
unzip -d ~/.vim/pack/vendor/start/ /tmp/vim-gnupg.zip
rm -f /tmp/vim-gnupg.zip

The plugin will be started by vim automatically. To edit an encrypted file, make sure it has an extension of .gpg, .pgp, or .asc. You will be asked to unlock your gpg key if it’s not already loaded in gpg-agent. Then you will be able to edit the file directly. When it’s saved, it will be re-encrypted.

I think that’s awesome.

facebookShare on Facebook
TwitterTweet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Full text search

Recent Posts

  • Terraform and segregated permissions
  • LVM Compression and Deduplication
  • Edit gpg encrypted file with vim
  • Lelit Elizabeth PL92T Pressure Tuning
  • jq transformation
  • aws (8)
  • coffee (1)
  • headfi (1)
  • linux (6)
  • others (58)
  • security (2)
  • tech (36)
  • wordpress (2)

apache aws awscli azure backup clearlinux cloud coffee docker DOCP ec2 EL8 epyc espresso featured gpg jenkins kernel lelit linux lvm meltdown memory MFA mikrotik php python rdp Redhat RHEL roasting rpm Ryzen site-to-site snapshot spectre tech terraform tuning ubuntu ubuntu upgrade vim vpn wordpress xdotool

©2023 blog.headdesk.me | Powered by SuperbThemes & WordPress