The Site of Mike

Random crap direct from Michael Marineau himself ;-)
Random crap direct from Michael Marineau himself ;-)
  • ask me anything
  • photo gallery
  • archive
  • rss
  • Tip of the day: Using GPG trasparently in vim

    Vim’s built in encryption feature is pretty handy but it’s algorithm is only strong enough to protect against a casual observer. For good encryption something else is required but I still want something that is fairly transparent. I’ve come up with a little solution using GnuPG, just add the following to your .vimrc to automatically encrypt and decrypt *.gpg files. (Replace GPGKEYID with your key id of course)

    au BufNewFile,BufReadPre *.gpg :set secure viminfo= noswapfile nobackup nowritebackup history=0 binary
    au BufReadPost *.gpg :%!gpg -d 2>/dev/null
    au BufWritePre *.gpg :%!gpg -e -r GPGKEYID 2>/dev/null
    au BufWritePost *.gpg u
    
    • August 19, 2008 (12:54 am)
    • #howto
© 2013 The Site of Mike