add gpg edit helper

Mon, 10 Oct 2016 01:14:22 -0400

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 10 Oct 2016 01:14:22 -0400
changeset 414
9536ca40b624
parent 413
4a2c2c1541d9
child 415
0012a1fb26e5

add gpg edit helper

.vimrc file | annotate | diff | comparison | revisions
--- a/.vimrc
+++ b/.vimrc
@@ -347,6 +347,15 @@ augroup vimrc
   autocmd BufLeave *.js                normal! mJ
   autocmd BufLeave *.pl,*.pm           normal! mP
 augroup END
+
+" https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/
+augroup encrypted
+  autocmd!
+  autocmd BufReadPre,FileReadPre *.gpg set noswapfile noundofile nobackup viminfo=
+  autocmd BufReadPost *.gpg :%!gpg --decrypt 2> /dev/null
+  autocmd BufWritePre *.gpg :%!gpg -se -a --default-recipient-self
+  autocmd BufWritePost *.gpg u
+augroup END
 "}}}
 
 

mercurial