From 6e9f52a160e3d15060848a8f453bd1b5bfa70db2 Mon Sep 17 00:00:00 2001 From: nachoalonso Date: Sun, 8 Sep 2013 19:07:21 +0100 Subject: [PATCH] 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 --- plugin/gnupg.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/gnupg.vim b/plugin/gnupg.vim index 4c62066..dfb2a5b 100644 --- a/plugin/gnupg.vim +++ b/plugin/gnupg.vim @@ -1,5 +1,5 @@ " Name: gnupg.vim -" Last Change: 2013 Jun 14 +" Last Change: 2013 Sep 09 " Maintainer: James McCoy " Original Author: Markus Braun " Summary: Vim plugin for transparent editing of gpg encrypted files. @@ -404,7 +404,7 @@ function s:GPGDecrypt(bufread) let b:GPGOptions = [] " 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 silent doautocmd User GnuPG " call the autocommand for the file minus .gpg$