747:a3c2fbf5a623 | 748:648b37626788 |
---|---|
1 " based on | |
2 " https://mjj.io/2015/01/27/encrypting-files-with-gpg-and-vim/ | |
3 " hacked to work with vimwiki | |
4 " moved to ftplugin | |
5 | |
6 setl noswapfile noundofile nobackup viminfo= | |
7 | |
8 sil %!GPG_TTY=/dev/tty gpg2 --decrypt 2>/dev/null | |
9 | |
10 augroup GPGWriteEncrypted | |
11 autocmd! | |
12 autocmd BufWritePre *.gpg,*.gpg.wiki :sil %!GPG_TTY=/dev/tty gpg2 -se -a --default-recipient-self 2>/dev/null | |
13 autocmd BufWritePost *.gpg,*.gpg.wiki :sil undo | |
14 augroup END |