From c2ddc05bc27a0d4df4f56b0daa45060e3195ea9d Mon Sep 17 00:00:00 2001 From: Scott Stevenson Date: Fri, 11 Dec 2015 12:26:50 +0000 Subject: [PATCH] Fall back to `gpg2` if `gpg` is not available Signed-off-by: James McCoy --- plugin/gnupg.vim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 7f685ea..06e1410 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -75,8 +75,9 @@ " Variables: {{{2 " " g:GPGExecutable -" If set used as gpg executable, otherwise the system chooses what is run -" when "gpg" is called. Defaults to "gpg --trust-model always". +" If set used as gpg executable. If unset, defaults to +" "gpg --trust-model always" if "gpg" is available, falling back to +" "gpg2 --trust-model always" if not. " " g:GPGUseAgent " If set to 0 a possible available gpg-agent won't be used. Defaults to 1. @@ -278,7 +279,11 @@ function s:GPGInit(bufread) " check what gpg command to use if (!exists("g:GPGExecutable")) - let g:GPGExecutable = "gpg --trust-model always" + if executable("gpg") + let g:GPGExecutable = "gpg --trust-model always" + else + let g:GPGExecutable = "gpg2 --trust-model always" + endif endif " check if gpg-agent is allowed