releasing gnupg.vim 2773

- fix a bug in detecting windows platforms
- added g:GPGPreferSign to sign encrypted files by default (thanks to Tim Swast).
This commit is contained in:
Markus Braun 2009-05-27 07:10:20 -04:00 committed by James Vega
parent 7fd5c92bce
commit e488aea931

View File

@ -1,5 +1,5 @@
" Name: gnupg.vim
" Version: $Id: gnupg.vim 2276 2008-08-15 12:50:33Z mbr $
" Version: $Id: gnupg.vim 2773 2009-05-27 07:10:20Z mbr $
" Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files.
" Licence: This program is free software; you can redistribute it and/or
@ -27,7 +27,7 @@
" You should always add the following lines to your .bashrc or whatever
" initialization file is used for all shell invocations:
"
" GPG_TTY=tty
" GPG_TTY=`tty`
" export GPG_TTY
"
" It is important that this environment variable always reflects the out
@ -68,11 +68,37 @@
" g:GPGPreferArmor
" If set to 1 armored data is preferred for new files. Defaults to 0.
"
" g:GPGPreferSign
" If set to 1 signed data is preferred for new files. Defaults to 0.
"
" g:GPGDefaultRecipients
" If set, these recipients are used as defaults when no other recipient is
" defined. This variable is a Vim list. Default is unset.
"
" Known Issues:
"
" In some cases gvim can't decryt 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
" and Linux versions of gvim and could not be solved unless a "terminal
" emulation" is implemented for gvim. To circumvent this you have to use any
" combination of gpg-agent and a graphical pinentry program:
"
" - gpg-agent only:
" you need to provide the passphrase for the needed key to gpg-agent
" in a terminal before you open files with gvim which require this key.
"
" - pinentry only:
" you will get a popup window every time you open a file that needs to
" be decrypted.
"
" - gpgagent and pinentry:
" you will get a popup window the first time you open a file that
" needs to be decrypted.
"
" Credits:
"
" - Mathieu Clabaut for inspirations through his vimspell.vim script.
" - Richard Bronosky for patch to enable ".pgp" suffix.
" - Erik Remmelzwaal for patch to enable windows support and patient beta
@ -84,6 +110,7 @@
" - Giel van Schijndel for patch to get GPG_TTY dynamically.
" - Sebastian Luettich for patch to fix issue with symmetric encryption an set
" recipients.
" - Tim Swast for patch to generate signed files
"
" Section: Plugin header {{{1
if (v:version < 700)
@ -95,7 +122,7 @@ if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)")
finish
endif
let g:loaded_gnupg = "$Revision: 2276 $"
let g:loaded_gnupg = "$Revision: 2773 $"
" Section: Autocmd setup {{{1
augroup GnuPG
@ -157,6 +184,11 @@ function s:GPGInit()
let g:GPGPreferArmor = 0
endif
" check if signed files are preferred
if (!exists("g:GPGPreferSign"))
let g:GPGPreferSign = 0
endif
" check if debugging is turned on
if (!exists("g:GPGDefaultRecipients"))
let g:GPGDefaultRecipients = []
@ -197,17 +229,17 @@ function s:GPGInit()
" setup shell environment for unix and windows
let s:shellredirsave = &shellredir
let s:shellsave = &shell
if (match(&shell,"\\(cmd\\|command\\).execute") >= 0)
" windows specific settings
let s:shellredir = '>%s'
let s:shell = &shell
let s:stderrredirnull = '2>nul'
else
if (has("unix"))
" unix specific settings
let s:shellredir = &shellredir
let s:shell = 'sh'
let s:stderrredirnull = '2>/dev/null'
let s:GPGCommand = "LANG=C LC_ALL=C " . s:GPGCommand
else
" windows specific settings
let s:shellredir = '>%s'
let s:shell = &shell
let s:stderrredirnull = '2>nul'
endif
" find the supported algorithms
@ -390,6 +422,9 @@ function s:GPGEncrypt()
if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1)
let b:GPGOptions += ["armor"]
endif
if (exists("g:GPGPreferSign") && g:GPGPreferSign == 1)
let b:GPGOptions += ["sign"]
endif
call s:GPGDebug(1, "no options set, so using default options: " . string(b:GPGOptions))
endif
@ -1012,4 +1047,5 @@ if (has("menu"))
amenu <silent> Plugin.GnuPG.View\ Options :GPGViewOptions<CR>
amenu <silent> Plugin.GnuPG.Edit\ Options :GPGEditOptions<CR>
endif
" vim600: foldmethod=marker:foldlevel=0
" vim600: set foldmethod=marker foldlevel=0 :