Commit Graph

202 Commits

Author SHA1 Message Date
James McCoy
2844d06498 Ignore keys that aren't usable for encryption rather than just expired keys
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
Thomas Arendsen Hein
6006af630b Do not echo debug messages when redirecting to a log file
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
5489147a47 Use "silent doautocmd" to suppress annoying "No matching autocmds" message
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
d973d05173 Change autocmd check to look for GnuPG group
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
94c0a22b8a Ignore expired keys.
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
0e86346933 GPGFinishRecipientsBuffer: Use the GPG ID, if present, to avoid repeat prompts
Whenever GPGFinishRecipientsBuffer is called, the buffer is processed to
convert names to IDs.  However, this was ignoring any existing ID information
in the buffer.  This meant that if a person had multiple keys, the user would
be prompted to disambiguate the keys after every :GPGEditRecipients session.

Parsing the ID out of the recipients buffer avoids the unnecessary prompting.

Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
53d086cb35 Pull the key pattern out to a constant
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
07fec22b0a Don't wipeout the current buffer if FileReadCmd failed
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:18 -04:00
James McCoy
181ed597f2 Suppress "N more lines" message when editing a file
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James McCoy
34c24a19e5 Only disable swapfile, undofile, and viminfo when editing a file.
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James McCoy
31a84b0730 Indicate whether GPGInit/GPGDecrypt were invoked from BufReadCmd
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James McCoy
39e54fbd96 Clear undo history as the last step of BufReadCmd
After opening a file, an immediate "u"/":undo" would remove the entire
contents of the buffer.  Even worse, this would not set 'modified', so there
would be no indication that wasn't the actual initial state of the buffer.

Discarding undo history for a buffer requires a few steps, including making a
change.  Luckily, a change is already being made (deleting the extra line left
after ":r !" the decrypted file), so discarding undo history can piggy-back on
top of that.

Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
Alex Efros
f04de4883c added doautocmd BufWritePre 2012-10-26 16:05:17 -04:00
James McCoy
ebc86fca44 Document the g:GPGHomedir option
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James McCoy
b470e4e11e Add support for specifying an alternate --homedir
Reported-By: Matt Callaway <matt.callaway@gmail.com>
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James McCoy
cd8aa8d0ce Consolidate handling of system()/:execute calls
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James Vega
571f46455e Resolve the filename when saving to follow symlinks.
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James Vega
904e392ae3 Initialize b:GPGRecipients with g:GPGDefaultRecipients
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James Vega
d645eb26cd Correctly handle the different keyid-format options
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James Vega
79a936311d Add g:GPGUsePipes variable to avoid saving unencrypted data to tempfiles
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James Vega
32c88feb43 Disable 'undofile' for the buffer, if the option exists
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:05:17 -04:00
James Vega
9e70b21d91 Update docs to show my takeover of gnupg.vim
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:05:00 -04:00
James Vega
f23c3c7643 Set 'noshelltemp' when executing gnupg
This is another step to prevent writing out sensitive information to disk.
Typically, when running an external command, Vim writes the command input (the
buffer in this case) to a file in a private temp directory.  When
'noshelltemp' is set and the system supports it, Vim uses pipes to the child
process to handle this instead.

Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:04:34 -04:00
James Vega
a37434ab5d Bump minimum Vim version to 7.2
The two argument form of shellescape() is now being used, and that was
introduced in the pre-releases of 7.2.

Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:04:34 -04:00
James Vega
6e178a6dd1 Check for our BufReadCmd to see if the plugin has been loaded.
Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:04:34 -04:00
James Vega
bf67f5561a Refactor to use *WriteCmd/*ReadCmd autocommands.
With this change, we're able to properly handle errors from shell commands.
This means no more overwriting the original file when an incorrect password is
entered or some other similar scenario.

Also, move the handling of entering recipients to gpg itself instead of
mimicking that in Vim itself.

Signed-off-by: James Vega <vega.james@gmail.com>
2012-10-26 16:04:34 -04:00
James McCoy
8786427bb3 Ignore keys that aren't usable for encryption rather than just expired keys
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-31 22:31:04 -04:00
Thomas Arendsen Hein
ff9c9a8366 Do not echo debug messages when redirecting to a log file
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-31 21:22:03 -04:00
James McCoy
70cfdc99bd Use "silent doautocmd" to suppress annoying "No matching autocmds" message
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-31 21:17:07 -04:00
James McCoy
8b38e3e859 Change autocmd check to look for GnuPG group
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-31 00:31:56 -04:00
James McCoy
0f4778240f Ignore expired keys.
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-31 00:31:36 -04:00
James McCoy
9329403402 GPGFinishRecipientsBuffer: Use the GPG ID, if present, to avoid repeat prompts
Whenever GPGFinishRecipientsBuffer is called, the buffer is processed to
convert names to IDs.  However, this was ignoring any existing ID information
in the buffer.  This meant that if a person had multiple keys, the user would
be prompted to disambiguate the keys after every :GPGEditRecipients session.

Parsing the ID out of the recipients buffer avoids the unnecessary prompting.

Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 23:48:43 -04:00
James McCoy
b2b4e7525c Pull the key pattern out to a constant
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 23:48:24 -04:00
James McCoy
ac45a5969e Don't wipeout the current buffer if FileReadCmd failed
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 22:18:34 -04:00
James McCoy
1354f3447d Suppress "N more lines" message when editing a file
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 22:18:01 -04:00
James McCoy
256810ab64 Only disable swapfile, undofile, and viminfo when editing a file.
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 22:17:05 -04:00
James McCoy
bceace5df6 Indicate whether GPGInit/GPGDecrypt were invoked from BufReadCmd
Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 22:15:46 -04:00
James McCoy
d7361d413c Clear undo history as the last step of BufReadCmd
After opening a file, an immediate "u"/":undo" would remove the entire
contents of the buffer.  Even worse, this would not set 'modified', so there
would be no indication that wasn't the actual initial state of the buffer.

Discarding undo history for a buffer requires a few steps, including making a
change.  Luckily, a change is already being made (deleting the extra line left
after ":r !" the decrypted file), so discarding undo history can piggy-back on
top of that.

Signed-off-by: James McCoy <vega.james@gmail.com>
2012-05-30 21:02:40 -04:00
Alex Efros
42c2d46aa2 added doautocmd BufWritePre 2012-01-14 00:37:31 +02:00
James McCoy
648fa8821d Document the g:GPGHomedir option
Signed-off-by: James McCoy <vega.james@gmail.com>
2011-11-23 17:09:42 -05:00
James McCoy
5394d0c1f1 Add support for specifying an alternate --homedir
Reported-By: Matt Callaway <matt.callaway@gmail.com>
Signed-off-by: James McCoy <vega.james@gmail.com>
2011-11-23 16:38:38 -05:00
James McCoy
7d102c843a Consolidate handling of system()/:execute calls
Signed-off-by: James McCoy <vega.james@gmail.com>
2011-11-23 16:14:56 -05:00
James Vega
e2e53bc315 Resolve the filename when saving to follow symlinks.
Signed-off-by: James Vega <vega.james@gmail.com>
2011-10-18 22:00:02 -04:00
James Vega
21eed8f06b Initialize b:GPGRecipients with g:GPGDefaultRecipients
Signed-off-by: James Vega <vega.james@gmail.com>
2011-10-13 17:22:09 -04:00
James Vega
df5f4d51bf Correctly handle the different keyid-format options
Signed-off-by: James Vega <vega.james@gmail.com>
2011-08-13 18:00:27 -04:00
James Vega
d19a59165d Add g:GPGUsePipes variable to avoid saving unencrypted data to tempfiles
Signed-off-by: James Vega <vega.james@gmail.com>
2011-08-09 21:24:44 -04:00
Markus Braun
a8838d0e86 Updated credits. 2011-07-06 08:05:43 +02:00
Markus Braun
efd23b4440 Patch by Erik Remmelzwaal
Make gnupg.vim work better on win32
2011-07-06 08:05:42 +02:00
Markus Braun
9e7c686de5 Patch by James Vega
Make use of shellescape() and fnameescape() functions which better escape filenames than previous handmade calls to escape().
2011-07-06 08:05:42 +02:00
Markus Braun
05a3e4e1f6 Reworked patch by James Vega because I don't like "continue". 2011-07-06 08:05:42 +02:00