.vimrc

changeset 748
648b37626788
parent 747
a3c2fbf5a623
child 749
27f7431c8170
--- a/.vimrc
+++ b/.vimrc
@@ -294,6 +294,17 @@ augroup vimrc
   autocmd BufNewFile,BufRead neomutt-*-\w\+ setf mail
 augroup END
 
+" https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/
+" hacked to work with vimwiki
+augroup encrypted
+  autocmd!
+  autocmd BufReadPre,FileReadPre *.gpg,*.gpg.wiki setl noswapfile noundofile nobackup viminfo=
+  autocmd BufReadPost *.gpg,*.gpg.wiki :sil %!GPG_TTY=/dev/tty gpg2 --decrypt 2> /dev/null
+  autocmd BufWritePre *.gpg,*.gpg.wiki :sil %!GPG_TTY=/dev/tty gpg2 -se -a --default-recipient-self
+  autocmd BufWritePost *.gpg,*.gpg.wiki :sil undo
+augroup END
+"}}}
+
 " Perl type-specific settings  {{{
 let perl_include_pod     = 1
 let perl_sub_signatures  = 1

mercurial