Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
Checking mergeability… Don’t worry, you can still create the pull request.
Commits on Jul 28, 2014
@jamessan jamessan Ensure b:GPGRecipients is initialized to a list value
Closes #18
Signed-off-by: James McCoy <>
Commits on Aug 10, 2014
@jamessan jamessan Put --homedir at the start of the command line
Closes jamessan/vim-gnupg#20
Signed-off-by: James McCoy <>
Commits on Oct 09, 2014
@tyll tyll Add g:GPGRecipientsMenu
Allow to set initial contents for recipients menu with
g:GPGRecipientsMenu. Example usage:

let g:GPGRecipientsMenu=""
    \."GPG: Example User <>\<NL>"
    \."GPG: Other User <>\<NL>"
Commits on Oct 29, 2014
Sebastian Neumann Refactor g:GPGRecipientsMenu to use list and rename to g:GPGPossibleR…

  let g:GPGPossibleRecipients=[
    \"Example User <>",
    \"Other User <>"
Commits on Nov 21, 2014
@jamessan jamessan Force Vim to re-setup the terminal after running a command
After Vim runs certain commands (e.g., pinentry-curses), the terminal is
not returned to its previous state.  This causes some escape sequences,
like arrow keys, to stop being recognized properly by Vim.

Re-setting &term to itself causes Vim to go through its normal terminal
initialization steps which gets things back in working order.

Closes jamessan/vim-gnupg#17
Signed-off-by: James McCoy <>
@jamessan jamessan Merge pull request #21 from tyll/menu
Add g:GPGRecipientsMenu
Commits on Dec 25, 2014
@blueyed blueyed Trigger BufWritePost event via BufWriteCmd/FileWriteCmd
Closes jamessan/vim-gnupg#23
Signed-off-by: James McCoy <>
@jamessan jamessan Emit FileWritePre/Post events when handling FileWriteCmd
Signed-off-by: James McCoy <>
@jamessan jamessan Don't change modified state of buffer for FileWriteCmd
Signed-off-by: James McCoy <>
Commits on Jan 06, 2015
@jamessan jamessan Emit BufReadPre/FileReadPre when decrypting the file
Signed-off-by: James McCoy <>
@jamessan jamessan Manually set [ and ] marks after decrypting
:lockmarks doesn't appear to preserve these marks.  They would need
to be adjusted anyway due to the line numbers changing, so just set the
marks to the start/end of the buffer.

Signed-off-by: James McCoy <>
@jamessan jamessan Trigger FileReadPost event after decrypting for :r
Signed-off-by: James McCoy <>
Commits on Feb 06, 2015
@jamessan jamessan Emit TermChanged when resetting &term
Resetting &term can affect various settings which are terminal
dependent (e.g., escape sequences described at “:help :set-termcap”).
Emitting TermChanged allows people to re-set these options so they don't
lose functionality (c.f. jamessan/vim-gnupg#28).

Signed-off-by: James McCoy <>
Commits on Mar 03, 2015
@jamessan jamessan Document that GPGSystem always uses temp files
Signed-off-by: James McCoy <>
Commits on Mar 22, 2015
@jamessan jamessan Silence "No matching autocommands" for TermChanged event
Signed-off-by: James McCoy <>
Commits on Jul 17, 2015
@jamessan jamessan Setup agent handling after determining gnupg's version
Starting with release 2.1, gnupg will automatically run gpg-agent rather
than requiring it to be run as a daemon.  The “--no-use-agent” switch
was also marked deprecated, since it no longer does anything.

This commit moves the --(no-)use-agent handling until after it is known
what version of gpg is being used.

Closes #37

Signed-off-by: James McCoy <>
Commits on Jul 26, 2015
@jamessan jamessan Remove “--batch” from command used to detect encryption
If the “log-file” option is set in ~/.gnupg/gpg.conf, then using “--batch”
means that the CLI's “--logger-fd” is ignored.  Since this command
shouldn't need any of “--batch”'s functionality and “log-file” hides all
the output we're expecting, dropping “--batch” is the sane thing to do.

Closes #40

Signed-off-by: James McCoy <>

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.
# Changes to be committed:
#	modified:   plugin/gnupg.vim
# Untracked files:
#	foo.asc
#	foo.gpg
#	foo.sig
# ------------------------ >8 ------------------------
# Do not touch the line above.
# Everything below will be removed.
diff --git c/plugin/gnupg.vim i/plugin/gnupg.vim
index 80f2061..b0bcd5c 100644
--- c/plugin/gnupg.vim
+++ i/plugin/gnupg.vim
@@ -1,5 +1,5 @@
 " Name:    gnupg.vim
-" Last Change: 2015 Jul 16
+" Last Change: 2015 Jul 26
 " Maintainer:  James McCoy <>
 " Original Author:  Markus Braun <>
 " Summary: Vim plugin for transparent editing of gpg encrypted files.
@@ -448,7 +448,7 @@ function s:GPGDecrypt(bufread)

   " find the recipients of the file
   let cmd = { 'level': 3 }
-  let cmd.args = '--verbose --decrypt --list-only --dry-run --batch --no-use-agent --logger-fd 1 ' . shellescape(filename)
+  let cmd.args = '--verbose --decrypt --list-only --dry-run --no-use-agent --logger-fd 1 ' . shellescape(filename)
   let output = s:GPGSystem(cmd)

   " Suppress the "N more lines" message when editing a file, not when reading
Commits on Sep 29, 2015
@jamessan jamessan Use `:language` command to force C locale
In non-Windows environments, the gpg command is prepended with “LANG=C
LC_ALL=C” to ensure gpg's output is consistent to allow for parsing the
information.  However, that doesn't work in Windows and won't
necessarily work if we ever remove the code forcing use of /bin/sh.

Since Vim already knows how to influence the environment, use its
“:language message …” command to set/restore the locale before/after
running the gpg command.

Closes jamessan/vim-gnupg#45
Signed-off-by: James McCoy <>
@jamessan jamessan Account for 'shellslash' being set on Windows
If a user has 'shellslash' set in Windows, then filename related
functionality uses forward slashes instead of backslashes.  This breaks
running of external commands because some external commands in Windows
treat any forward slash as a command line switch.

This change adds s:shellescape(), which wraps Vim's shellescape(), but
ensures 'noshellslash' is set first in Windows command prompt (not
Cygwin or msys) environments.  Having 'noshellslash' set when
shellescape() is called causes the string to be quoted, regardless of
whether there is whitespace or typical special characters, thus avoiding
the interpretation of the string as being command line switches.

Closes jamessan/vim-gnupg#41
Signed-off-by: James McCoy <>
Commits on Oct 06, 2015
@rudis rudis update documentation to match code, add missing defaults
Signed-off-by: James McCoy <>
@rudis rudis use .= where possible
Signed-off-by: James McCoy <>
@rudis rudis use variable for fnameescape(expand('<afile>:r'))
Signed-off-by: James McCoy <>
@rudis rudis remove superfluous | in BufReadCmd autocmd
Signed-off-by: James McCoy <>
@rudis rudis remove unnecessary exists check for g:GPGPreferSymmetric
The variable is always set in GPGInit().

Signed-off-by: James McCoy <>
Commits on Nov 05, 2015
@jamessan jamessan Set 'readonly' per the permissions of the encrypted file.
Closes jamessan/vim-gnupg#51
Signed-off-by: James McCoy <>
@jamessan jamessan Ignore hidden recipients when decrypting
When --throw-keyids, --hidden-recipient, or --hidden-encrypt-to were
used for an encrypted file, the encryption metadata uses all zeroes as
the key ID.  Ignore these key IDs to avoid generating extraneous
messages during decryption or adding invalid IDs to the recipients list.

Closes jamessan/vim-gnupg#50
Signed-off-by: James McCoy <>
@jamessan jamessan After writing the buffer to disk, update 'readonly'
Signed-off-by: James McCoy <>
Something went wrong with that request. Please try again.