tag 496667 patch
thanks

On Wed, Jan 27, 2010 at 08:11:53AM -0500, James Vega wrote:
> Would it be possible to add an option (or default behavior) to prefer
> armor specifically for .asc files?  Since .asc is the filename used by
> gnupg when given the --armor option, the current behavior seems a bit
> backwards.

Attached patch defaults to using armored data if the user hasn't set
g:GPGPreferArmor and a *.asc file is being edited.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
From 0d45c13f8c722ce3d0240077c8f7826df0560a2a Mon Sep 17 00:00:00 2001
From: James Vega <[email protected]>
Date: Thu, 28 Jan 2010 23:27:02 -0500
Subject: [PATCH 1/3] Prefer armored data for *.asc files.

Signed-off-by: James Vega <[email protected]>
---
 plugin/gnupg.vim |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim
index 09116d6..fdbbfc0 100644
--- a/plugin/gnupg.vim
+++ b/plugin/gnupg.vim
@@ -71,7 +71,8 @@
 "     If set to 1 symmetric encryption is preferred for new files. Defaults to 0.
 "
 "   g:GPGPreferArmor
-"     If set to 1 armored data is preferred for new files. Defaults to 0.
+"     If set to 1 armored data is preferred for new files. Defaults to 0
+"     unless a "*.asc" file is being edited.
 "
 "   g:GPGPreferSign
 "     If set to 1 signed data is preferred for new files. Defaults to 0.
@@ -82,7 +83,7 @@
 "
 " Known Issues: {{{2
 "
-"   In some cases gvim can't decryt files
+"   In some cases gvim can't decrypt files
 
 "   This is caused by the fact that a running gvim has no TTY and thus gpg is
 "   not able to ask for the passphrase by itself. This is a problem for Windows
@@ -197,7 +198,12 @@ function s:GPGInit()
 
   " check if armored files are preferred
   if (!exists("g:GPGPreferArmor"))
-    let g:GPGPreferArmor = 0
+    " .asc files should be armored as that's what the extension is used for
+    if expand('<afile>') =~ '\.asc$'
+      let g:GPGPreferArmor = 1
+    else
+      let g:GPGPreferArmor = 0
+    endif
   endif
 
   " check if signed files are preferred
-- 
1.6.6

Attachment: signature.asc
Description: Digital signature

Reply via email to