parsed.org

add these lines to your vimrc and you can read/write .gpg files. passwortd will be prompted by vim. ('ksh' needs to be installed):

augroup gpg
  au!
  autocmd BufReadPre *.gpg set binary noswapfile
  autocmd BufRead *.gpg call s:Decrypt()
  autocmd BufWrite *.gpg call s:Encrypt()
augroup END

function s:Decrypt()
 set shell=ksh
 let s:mykey = inputsecret("Enter passphrase:")
 exe "%! { echo " . escape(s:mykey, "!\"|") . "|& };
  \ gpg -q --no-mdc-warning --passphrase-fd 3 3<&p --decrypt 2>/dev/tty"
 set nobin
 if !nextnonblank(1)
   echohl ErrorMsg
   call input("type ENTER to exit")
   :q!
 endif
endf

function s:Encrypt()
 exe "%! { echo " . escape(s:mykey, "!\"|") . "|& };
  \ gpg -q --passphrase-fd 3 3<&p -sear Fabian -"
endf
encryptiongpgvim
RSS