Sat, 16 Mar 2019 19:25:44 -0400
Separate errors from filter stream
.vim/autoload/vimrc.vim | file | annotate | diff | comparison | revisions | |
.vimrc | file | annotate | diff | comparison | revisions |
--- a/.vim/autoload/vimrc.vim +++ b/.vim/autoload/vimrc.vim @@ -47,3 +47,16 @@ func! vimrc#Hgcd() abort pwd endfunc +func! vimrc#SafeFilterFile(cmd) + let errors = tempname() + try + exec 'silent %!' . a:cmd . ' 2>' . shellescape(errors) + if v:shell_error + for line in readfile(errors) + echomsg line + endfor + endif + finally + call delete(errors) + endtry +endfunc
--- a/.vimrc +++ b/.vimrc @@ -299,8 +299,8 @@ augroup END augroup encrypted autocmd! autocmd BufReadPre,FileReadPre *.gpg,*.gpg.* setl noswapfile noundofile nobackup viminfo= - autocmd BufReadPost *.gpg,*.gpg.* :sil %!gpg2 -d - autocmd BufWritePre *.gpg,*.gpg.* :sil %!gpg2 -se -a --default-recipient-self + autocmd BufReadPost *.gpg,*.gpg.* call vimrc#SafeFilterFile('gpg2 -d') + autocmd BufWritePre *.gpg,*.gpg.* call vimrc#SafeFilterFile('gpg2 -se -a --default-recipient-self') autocmd BufWritePost *.gpg,*.gpg.* :sil undo augroup END "}}}