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 <vega.james@gmail.com>
This commit is contained in:
James McCoy 2014-11-20 23:18:59 -05:00
parent 40cec4652c
commit bd3ebdff6c

View File

@ -1,5 +1,5 @@
" Name: gnupg.vim " Name: gnupg.vim
" Last Change: 2014 Aug 10 " Last Change: 2014 Nov 20
" Maintainer: James McCoy <vega.james@gmail.com> " Maintainer: James McCoy <vega.james@gmail.com>
" Original Author: Markus Braun <markus.braun@krawel.de> " Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files. " Summary: Vim plugin for transparent editing of gpg encrypted files.
@ -1255,6 +1255,10 @@ function s:GPGPostCmd()
let &shellredir = s:shellredirsave let &shellredir = s:shellredirsave
let &shell = s:shellsave let &shell = s:shellsave
let &shelltemp = s:shelltempsave let &shelltemp = s:shelltempsave
" Workaround a bug in the interaction between console vim and
" pinentry-curses by forcing Vim to re-detect and setup its terminal
" settings
let &term = &term
endfunction endfunction
" Function: s:GPGSystem(dict) {{{2 " Function: s:GPGSystem(dict) {{{2