Suppress "N more lines" message when editing a file

Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
James McCoy 2012-05-30 22:18:01 -04:00
parent 34c24a19e5
commit 181ed597f2

View File

@ -377,6 +377,10 @@ function s:GPGDecrypt(bufread)
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 --batch --no-use-agent --logger-fd 1 ' . shellescape(filename)
let output = s:GPGSystem(cmd) let output = s:GPGSystem(cmd)
" Suppress the "N more lines" message when editing a file, not when reading
" the contents of a file into a buffer
let silent = a:bufread ? 'silent ' : ''
let asymmPattern = 'gpg: public key is \%(0x\)\=[[:xdigit:]]\{8,16}' let asymmPattern = 'gpg: public key is \%(0x\)\=[[:xdigit:]]\{8,16}'
" check if the file is symmetric/asymmetric encrypted " check if the file is symmetric/asymmetric encrypted
if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0) if (match(output, "gpg: encrypted with [[:digit:]]\\+ passphrase") >= 0)
@ -429,7 +433,7 @@ function s:GPGDecrypt(bufread)
echohl GPGWarning echohl GPGWarning
echom "File is not encrypted, all GPG functions disabled!" echom "File is not encrypted, all GPG functions disabled!"
echohl None echohl None
silent exe '.r ' . fnameescape(filename) exe printf('%sr %s', silent, fnameescape(filename))
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()") call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
return return
endif endif
@ -444,7 +448,7 @@ function s:GPGDecrypt(bufread)
" since even with the --quiet option passphrase typos will be reported, " since even with the --quiet option passphrase typos will be reported,
" we must redirect stderr (using shell temporarily) " we must redirect stderr (using shell temporarily)
call s:GPGDebug(1, "decrypting file") call s:GPGDebug(1, "decrypting file")
let cmd = { 'level': 1, 'ex': 'r !' } let cmd = { 'level': 1, 'ex': silent . 'r !' }
let cmd.args = '--quiet --decrypt ' . shellescape(filename, 1) let cmd.args = '--quiet --decrypt ' . shellescape(filename, 1)
call s:GPGExecute(cmd) call s:GPGExecute(cmd)