Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Commits on Jul 26, 2015
  1. 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 Jul 17, 2015
  1. 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 Mar 22, 2015
  1. Silence "No matching autocommands" for TermChanged event

    Signed-off-by: James McCoy <>
Commits on Mar 3, 2015
  1. Document that GPGSystem always uses temp files

    Signed-off-by: James McCoy <>
Commits on Feb 6, 2015
  1. 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 Jan 6, 2015
  1. Trigger FileReadPost event after decrypting for :r

    Signed-off-by: James McCoy <>
  2. 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 <>
  3. Emit BufReadPre/FileReadPre when decrypting the file

    Signed-off-by: James McCoy <>
Commits on Dec 25, 2014
  1. Don't change modified state of buffer for FileWriteCmd

    Signed-off-by: James McCoy <>
  2. Emit FileWritePre/Post events when handling FileWriteCmd

    Signed-off-by: James McCoy <>
  3. @blueyed

    Trigger BufWritePost event via BufWriteCmd/FileWriteCmd

    blueyed authored committed
    Closes jamessan/vim-gnupg#23
    Signed-off-by: James McCoy <>
Commits on Nov 21, 2014
  1. Merge pull request #21 from tyll/menu

    Add g:GPGRecipientsMenu
  2. 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 <>
Commits on Oct 29, 2014
  1. Refactor g:GPGRecipientsMenu to use list and rename to g:GPGPossibleR…

    Sebastian Neumann authored
      let g:GPGPossibleRecipients=[
        \"Example User <>",
        \"Other User <>"
Commits on Oct 9, 2014
  1. @tyll

    Add g:GPGRecipientsMenu

    tyll authored
    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 Aug 10, 2014
  1. Put --homedir at the start of the command line

    Closes jamessan/vim-gnupg#20
    Signed-off-by: James McCoy <>
Commits on Jul 28, 2014
  1. Ensure b:GPGRecipients is initialized to a list value

    Closes #18
    Signed-off-by: James McCoy <>
Commits on Sep 10, 2013
  1. @nachoalonso

    Use filereadable() instead of glob() to detect whether a file exists.

    nachoalonso authored committed
    glob() reports false positives if the filename has metacharacters in it
    (e.g., "[...]"), which causes Vim to incorrectly open a new, blank
    buffer instead of the specified file.
    Closes jamessan/vim-gnupg#12
    Signed-off-by: James McCoy <>
Commits on Jun 15, 2013
  1. Restore the :silent command when encrypting the buffer

    This was lost in the refactor of external command handling, commit
    7d102c8, and was causing an unnecessary "Press ENTER …" prompt to be
    emitted whenever the buffer was written out.
    Signed-off-by: James McCoy <>
Commits on Apr 24, 2013
  1. Allow definition of actions specific to GnuPG-managed buffers

    If there are specific actions that should take place when editing a
    GnuPG-managed buffer, an autocmd for the User event and GnuPG pattern
    can be defined.  For example, the following will set 'textwidth' to 72
    for all GnuPG-encrypted buffers:
        autocmd User GnuPG setl textwidth=72
    This will be triggered before any BufRead or BufNewFile autocmds, and
    therefore will not take precedence over settings specific to any
    filetype that may get set.
    Closes jamessan/vim-gnupg#10
    Signed-off-by: James McCoy <>
Commits on Feb 22, 2013
  1. Merge pull request #8 from Jonty/edit-recipients-on-new-file

    Edit recipients when opening a new file
  2. Merge pull request #7 from Jonty/do-not-attempt-encryption-in-settings

    Do not trigger encrypt on BufWrite etc in settings windows
  3. @Jonty

    Edit recipients when opening a new file

    Jonty authored
    The previous behaviour of this plugin was to open the recipient pane
    immediately after opening a new file with the correct extension. The
    documentation states that this should still occur, so this commit
    implements the behaviour in a slightly different manner than the old
  4. @Jonty

    Do not trigger encrypt on BufWrite etc in settings

    Jonty authored
    If a user :w's when in the options or recipient panes the global
    bufwrite handlers will be called, triggering an attempt to encrypt the
    file. The user will be dropped into the command line recipient adding
    process, and the recipients listed in the buffer will be ignored.
    This commit checks to see if a buffer is a child of another by looking
    for the buffer local var containing the parent buffer name, and only
    runs the encryption if it is not present.
Commits on Feb 10, 2013
  1. Document g:GPGFilePattern

Commits on Feb 5, 2013
  1. Merge pull request #6 from matt-garman/patch-1

    copy() g:GPGDefaultRecipients to b:GPGRecipients
  2. @matt-garman

    Update plugin/gnupg.vim

    matt-garman authored
    Need to use copy() when setting b:GPGRecipients in GPGDecrypt(), otherwise the local variable will act as a reference to the global one.  The result will be that the global default recipient list will become a super-set of recipients as multiple gpg files are opened.
  3. @vaz

    Add g:GPGFilePattern to allow custom target filename patterns.

    vaz authored
    This can be really handy when using vim as an external editor
    for a program (via temporary files) that you'd like to be able to
    encrypt based on the temp file's name (for example, when using
    vim as an external editor for Notational Velocity).
Commits on Jan 28, 2013
  1. Show all uids when disambiguating a key.

    Previously, only a contiguous block of uids would be presented to the
    user when trying to disambiguate a key.  This happened because a key may
    have other fields interspersed among the uids, like UAT.
    Signed-off-by: James McCoy <>
Commits on Jan 25, 2013
  1. Return a dictionary from GPGCheckRecipients

    This is a step towards reporting keys that aren't valid for encryption
    instead of just ignoring them.
    Signed-off-by: James McCoy <>
  2. Only define "unknown recipient" syntax if there are unknown recipients

    Signed-off-by: James McCoy <>
Commits on Dec 22, 2012
  1. Log v:shell_error after executing a shell command

    Signed-off-by: James McCoy <>
Commits on Oct 29, 2012
  1. Run tty in a shell that has stdin attached to a tty

    Using system('tty') will always report "not a tty", since the spawned shell
    has stdin redirected.  In order to get an accurate value for $GPG_TTY when
    it's not already set, read the output of the tty command using :!.
    This requires a bit more setup/teardown to ensure the buffer and user's undo
    state aren't affected, but it's the only way to accurately determine the
    user's tty.
    Closes: #1
    Signed-off-by: James McCoy <>
  2. Reduce "$GPG_TTY unset" message to one line and highlight as a warning.

    It's possible that gpg will work fine without $GPG_TTY being set (e.g., when
    using a GUI pinentry program).  Therefore, the message should be classified as
    a warning, not an error.
    Also, use a single :echom to ensure the user sees the entire message, not just
    "gpg-agent might not work."
    First part of GH #1
    Signed-off-by: James McCoy <>
Something went wrong with that request. Please try again.