mirror of
https://github.com/Ascyii/vim-gnupg.git
synced 2026-01-01 06:14:24 -05:00
Merge branch 'tty-cmd-cleanup'
* Delete all output from "tty" command * Do not try to run tty command if it doesn't exist
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
" Name: autoload/gnupg.vim
|
" Name: autoload/gnupg.vim
|
||||||
" Last Change: 2019 Feb 11
|
" Last Change: 2019 Aug 23
|
||||||
" Maintainer: James McCoy <jamessan@jamessan.com>
|
" Maintainer: James McCoy <jamessan@jamessan.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.
|
||||||
@@ -213,18 +213,20 @@ function gnupg#init(bufread)
|
|||||||
" modified just by detecting the correct tty value.
|
" modified just by detecting the correct tty value.
|
||||||
" Do the &undolevels dance so the :read and :delete don't get added into
|
" Do the &undolevels dance so the :read and :delete don't get added into
|
||||||
" the undo tree, as the user needn't be aware of these.
|
" the undo tree, as the user needn't be aware of these.
|
||||||
let [mod, levels] = [&l:modified, &undolevels]
|
if executable('tty')
|
||||||
set undolevels=-1
|
let [mod, levels] = [&l:modified, &undolevels]
|
||||||
silent read !tty
|
set undolevels=-1
|
||||||
let $GPG_TTY = getline('.')
|
silent read !tty
|
||||||
silent delete
|
let $GPG_TTY = getline('.')
|
||||||
let [&l:modified, &undolevels] = [mod, levels]
|
silent '[,']delete _
|
||||||
" redraw is needed since we're using silent to run !tty, c.f. :help :!
|
let [&l:modified, &undolevels] = [mod, levels]
|
||||||
redraw!
|
" redraw is needed since we're using silent to run !tty, c.f. :help :!
|
||||||
if (v:shell_error)
|
redraw!
|
||||||
|
endif
|
||||||
|
if v:shell_error || !exists("$GPG_TTY")
|
||||||
let $GPG_TTY = ""
|
let $GPG_TTY = ""
|
||||||
echohl GPGWarning
|
echohl GPGWarning
|
||||||
echom "$GPG_TTY is not set and the `tty` command failed! gpg-agent might not work."
|
echom "$GPG_TTY is not set and the `tty` command failed/doesn't exist! gpg-agent might not work."
|
||||||
echohl None
|
echohl None
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user