Use filereadable() instead of glob() to detect whether a file exists.
glob() reports false positives if the filename has metacharacters in it (e.g., "[...]"), which causes Vim to incorrectly open a new, blank buffer instead of the specified file. Closes jamessan/vim-gnupg#12 Signed-off-by: James McCoy <vega.james@gmail.com>
This commit is contained in:
parent
15fd394fc5
commit
6e9f52a160
@ -1,5 +1,5 @@
|
|||||||
" Name: gnupg.vim
|
" Name: gnupg.vim
|
||||||
" Last Change: 2013 Jun 14
|
" Last Change: 2013 Sep 09
|
||||||
" 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.
|
||||||
@ -404,7 +404,7 @@ function s:GPGDecrypt(bufread)
|
|||||||
let b:GPGOptions = []
|
let b:GPGOptions = []
|
||||||
|
|
||||||
" File doesn't exist yet, so nothing to decrypt
|
" File doesn't exist yet, so nothing to decrypt
|
||||||
if empty(glob(filename))
|
if !filereadable(filename)
|
||||||
" Allow the user to define actions for GnuPG buffers
|
" Allow the user to define actions for GnuPG buffers
|
||||||
silent doautocmd User GnuPG
|
silent doautocmd User GnuPG
|
||||||
" call the autocommand for the file minus .gpg$
|
" call the autocommand for the file minus .gpg$
|
||||||
|
Loading…
x
Reference in New Issue
Block a user