mirror of
https://github.com/Ascyii/vim-gnupg.git
synced 2026-01-01 06:14:24 -05:00
Trigger FileReadPost event after decrypting for :r
Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
@@ -186,8 +186,7 @@ augroup GnuPG
|
|||||||
|
|
||||||
" do the decryption
|
" do the decryption
|
||||||
exe "autocmd BufReadCmd " . g:GPGFilePattern . " call s:GPGInit(1) |" .
|
exe "autocmd BufReadCmd " . g:GPGFilePattern . " call s:GPGInit(1) |" .
|
||||||
\ " call s:GPGDecrypt(1) |" .
|
\ " call s:GPGDecrypt(1) |"
|
||||||
\ " call s:GPGBufReadPost()"
|
|
||||||
exe "autocmd FileReadCmd " . g:GPGFilePattern . " call s:GPGInit(0) |" .
|
exe "autocmd FileReadCmd " . g:GPGFilePattern . " call s:GPGInit(0) |" .
|
||||||
\ " call s:GPGDecrypt(0)"
|
\ " call s:GPGDecrypt(0)"
|
||||||
|
|
||||||
@@ -545,19 +544,7 @@ function s:GPGDecrypt(bufread)
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" refresh screen
|
if a:bufread
|
||||||
redraw!
|
|
||||||
|
|
||||||
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" Function: s:GPGBufReadPost() {{{2
|
|
||||||
"
|
|
||||||
" Handle functionality specific to opening a file for reading rather than
|
|
||||||
" reading the contents of a file into a buffer
|
|
||||||
"
|
|
||||||
function s:GPGBufReadPost()
|
|
||||||
call s:GPGDebug(3, ">>>>>>>> Entering s:GPGBufReadPost()")
|
|
||||||
" In order to make :undo a no-op immediately after the buffer is read,
|
" In order to make :undo a no-op immediately after the buffer is read,
|
||||||
" we need to do this dance with 'undolevels'. Actually discarding the undo
|
" we need to do this dance with 'undolevels'. Actually discarding the undo
|
||||||
" history requires performing a change after setting 'undolevels' to -1 and,
|
" history requires performing a change after setting 'undolevels' to -1 and,
|
||||||
@@ -571,12 +558,22 @@ function s:GPGBufReadPost()
|
|||||||
1mark [
|
1mark [
|
||||||
$mark ]
|
$mark ]
|
||||||
let &undolevels = levels
|
let &undolevels = levels
|
||||||
" Allow the user to define actions for GnuPG buffers
|
|
||||||
silent doautocmd User GnuPG
|
|
||||||
" call the autocommand for the file minus .gpg$
|
" call the autocommand for the file minus .gpg$
|
||||||
silent execute ':doautocmd BufReadPost ' . fnameescape(expand('<afile>:r'))
|
silent execute ':doautocmd BufReadPost ' . fnameescape(expand('<afile>:r'))
|
||||||
call s:GPGDebug(2, 'called BufReadPost autocommand for ' . fnameescape(expand('<afile>:r')))
|
call s:GPGDebug(2, 'called BufReadPost autocommand for ' . fnameescape(expand('<afile>:r')))
|
||||||
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGBufReadPost()")
|
else
|
||||||
|
" call the autocommand for the file minus .gpg$
|
||||||
|
silent execute ':doautocmd FileReadPost ' . fnameescape(expand('<afile>:r'))
|
||||||
|
call s:GPGDebug(2, 'called FileReadPost autocommand for ' . fnameescape(expand('<afile>:r')))
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Allow the user to define actions for GnuPG buffers
|
||||||
|
silent doautocmd User GnuPG
|
||||||
|
|
||||||
|
" refresh screen
|
||||||
|
redraw!
|
||||||
|
|
||||||
|
call s:GPGDebug(3, "<<<<<<<< Leaving s:GPGDecrypt()")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:GPGEncrypt() {{{2
|
" Function: s:GPGEncrypt() {{{2
|
||||||
|
|||||||
Reference in New Issue
Block a user