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:
parent
7fd5c92bce
commit
e488aea931
@ -1,5 +1,5 @@
|
|||||||
" Name: gnupg.vim
|
" 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>
|
" Author: Markus Braun <markus.braun@krawel.de>
|
||||||
" Summary: Vim plugin for transparent editing of gpg encrypted files.
|
" Summary: Vim plugin for transparent editing of gpg encrypted files.
|
||||||
" Licence: This program is free software; you can redistribute it and/or
|
" Licence: This program is free software; you can redistribute it and/or
|
||||||
@ -7,7 +7,7 @@
|
|||||||
" See http://www.gnu.org/copyleft/gpl.txt
|
" See http://www.gnu.org/copyleft/gpl.txt
|
||||||
" Section: Documentation {{{1
|
" Section: Documentation {{{1
|
||||||
" Description:
|
" Description:
|
||||||
"
|
"
|
||||||
" This script implements transparent editing of gpg encrypted files. The
|
" This script implements transparent editing of gpg encrypted files. The
|
||||||
" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such
|
" filename must have a ".gpg", ".pgp" or ".asc" suffix. When opening such
|
||||||
" a file the content is decrypted, when opening a new file the script will
|
" a file the content is decrypted, when opening a new file the script will
|
||||||
@ -15,7 +15,7 @@
|
|||||||
" encrypted to all recipients before it is written. The script turns off
|
" encrypted to all recipients before it is written. The script turns off
|
||||||
" viminfo and swapfile to increase security.
|
" viminfo and swapfile to increase security.
|
||||||
"
|
"
|
||||||
" Installation:
|
" Installation:
|
||||||
"
|
"
|
||||||
" Copy the gnupg.vim file to the $HOME/.vim/plugin directory.
|
" Copy the gnupg.vim file to the $HOME/.vim/plugin directory.
|
||||||
" Refer to ':help add-plugin', ':help add-global-plugin' and ':help
|
" Refer to ':help add-plugin', ':help add-global-plugin' and ':help
|
||||||
@ -27,7 +27,7 @@
|
|||||||
" You should always add the following lines to your .bashrc or whatever
|
" You should always add the following lines to your .bashrc or whatever
|
||||||
" initialization file is used for all shell invocations:
|
" initialization file is used for all shell invocations:
|
||||||
"
|
"
|
||||||
" GPG_TTY=‘tty‘
|
" GPG_TTY=`tty`
|
||||||
" export GPG_TTY
|
" export GPG_TTY
|
||||||
"
|
"
|
||||||
" It is important that this environment variable always reflects the out‐
|
" It is important that this environment variable always reflects the out‐
|
||||||
@ -68,22 +68,49 @@
|
|||||||
" g:GPGPreferArmor
|
" 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.
|
||||||
"
|
"
|
||||||
|
" g:GPGPreferSign
|
||||||
|
" If set to 1 signed data is preferred for new files. Defaults to 0.
|
||||||
|
"
|
||||||
" g:GPGDefaultRecipients
|
" g:GPGDefaultRecipients
|
||||||
" If set, these recipients are used as defaults when no other recipient is
|
" If set, these recipients are used as defaults when no other recipient is
|
||||||
" defined. This variable is a Vim list. Default is unset.
|
" 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:
|
" Credits:
|
||||||
" - Mathieu Clabaut for inspirations through his vimspell.vim script.
|
"
|
||||||
" - Richard Bronosky for patch to enable ".pgp" suffix.
|
" - Mathieu Clabaut for inspirations through his vimspell.vim script.
|
||||||
" - Erik Remmelzwaal for patch to enable windows support and patient beta
|
" - Richard Bronosky for patch to enable ".pgp" suffix.
|
||||||
" testing.
|
" - Erik Remmelzwaal for patch to enable windows support and patient beta
|
||||||
" - Lars Becker for patch to make gpg2 working.
|
" testing.
|
||||||
" - Thomas Arendsen Hein for patch to convert encoding of gpg output
|
" - Lars Becker for patch to make gpg2 working.
|
||||||
" - Karl-Heinz Ruskowski for patch to fix unknown recipients and trust model
|
" - Thomas Arendsen Hein for patch to convert encoding of gpg output
|
||||||
" and patient beta testing.
|
" - Karl-Heinz Ruskowski for patch to fix unknown recipients and trust model
|
||||||
" - Giel van Schijndel for patch to get GPG_TTY dynamically.
|
" and patient beta testing.
|
||||||
" - Sebastian Luettich for patch to fix issue with symmetric encryption an set
|
" - Giel van Schijndel for patch to get GPG_TTY dynamically.
|
||||||
" recipients.
|
" - 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
|
" Section: Plugin header {{{1
|
||||||
if (v:version < 700)
|
if (v:version < 700)
|
||||||
@ -95,7 +122,7 @@ if (exists("g:loaded_gnupg") || &cp || exists("#BufReadPre#*.\(gpg\|asc\|pgp\)")
|
|||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:loaded_gnupg = "$Revision: 2276 $"
|
let g:loaded_gnupg = "$Revision: 2773 $"
|
||||||
|
|
||||||
" Section: Autocmd setup {{{1
|
" Section: Autocmd setup {{{1
|
||||||
augroup GnuPG
|
augroup GnuPG
|
||||||
@ -132,7 +159,7 @@ highlight default link GPGHighlightUnknownRecipient ErrorMsg
|
|||||||
function s:GPGInit()
|
function s:GPGInit()
|
||||||
" first make sure nothing is written to ~/.viminfo while editing
|
" first make sure nothing is written to ~/.viminfo while editing
|
||||||
" an encrypted file.
|
" an encrypted file.
|
||||||
set viminfo=
|
set viminfo=
|
||||||
|
|
||||||
" we don't want a swap file, as it writes unencrypted data to disk
|
" we don't want a swap file, as it writes unencrypted data to disk
|
||||||
set noswapfile
|
set noswapfile
|
||||||
@ -157,6 +184,11 @@ function s:GPGInit()
|
|||||||
let g:GPGPreferArmor = 0
|
let g:GPGPreferArmor = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" check if signed files are preferred
|
||||||
|
if (!exists("g:GPGPreferSign"))
|
||||||
|
let g:GPGPreferSign = 0
|
||||||
|
endif
|
||||||
|
|
||||||
" check if debugging is turned on
|
" check if debugging is turned on
|
||||||
if (!exists("g:GPGDefaultRecipients"))
|
if (!exists("g:GPGDefaultRecipients"))
|
||||||
let g:GPGDefaultRecipients = []
|
let g:GPGDefaultRecipients = []
|
||||||
@ -197,17 +229,17 @@ function s:GPGInit()
|
|||||||
" setup shell environment for unix and windows
|
" setup shell environment for unix and windows
|
||||||
let s:shellredirsave = &shellredir
|
let s:shellredirsave = &shellredir
|
||||||
let s:shellsave = &shell
|
let s:shellsave = &shell
|
||||||
if (match(&shell,"\\(cmd\\|command\\).execute") >= 0)
|
if (has("unix"))
|
||||||
" windows specific settings
|
|
||||||
let s:shellredir = '>%s'
|
|
||||||
let s:shell = &shell
|
|
||||||
let s:stderrredirnull = '2>nul'
|
|
||||||
else
|
|
||||||
" unix specific settings
|
" unix specific settings
|
||||||
let s:shellredir = &shellredir
|
let s:shellredir = &shellredir
|
||||||
let s:shell = 'sh'
|
let s:shell = 'sh'
|
||||||
let s:stderrredirnull = '2>/dev/null'
|
let s:stderrredirnull = '2>/dev/null'
|
||||||
let s:GPGCommand = "LANG=C LC_ALL=C " . s:GPGCommand
|
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
|
endif
|
||||||
|
|
||||||
" find the supported algorithms
|
" find the supported algorithms
|
||||||
@ -390,6 +422,9 @@ function s:GPGEncrypt()
|
|||||||
if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1)
|
if (exists("g:GPGPreferArmor") && g:GPGPreferArmor == 1)
|
||||||
let b:GPGOptions += ["armor"]
|
let b:GPGOptions += ["armor"]
|
||||||
endif
|
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))
|
call s:GPGDebug(1, "no options set, so using default options: " . string(b:GPGOptions))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -1012,4 +1047,5 @@ if (has("menu"))
|
|||||||
amenu <silent> Plugin.GnuPG.View\ Options :GPGViewOptions<CR>
|
amenu <silent> Plugin.GnuPG.View\ Options :GPGViewOptions<CR>
|
||||||
amenu <silent> Plugin.GnuPG.Edit\ Options :GPGEditOptions<CR>
|
amenu <silent> Plugin.GnuPG.Edit\ Options :GPGEditOptions<CR>
|
||||||
endif
|
endif
|
||||||
" vim600: foldmethod=marker:foldlevel=0
|
|
||||||
|
" vim600: set foldmethod=marker foldlevel=0 :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user