Skip to content

Commit

Permalink
Use filereadable() instead of glob() to detect whether a file exists.
Browse files Browse the repository at this point in the history
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 #12

Signed-off-by: James McCoy <vega.james@gmail.com>
  • Loading branch information
nachoalonso authored and jamessan committed Sep 10, 2013
1 parent 15fd394 commit 6e9f52a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/gnupg.vim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
" Name: gnupg.vim
" Last Change: 2013 Jun 14
" Last Change: 2013 Sep 09
" Maintainer: James McCoy <vega.james@gmail.com>
" Original Author: Markus Braun <markus.braun@krawel.de>
" Summary: Vim plugin for transparent editing of gpg encrypted files.
Expand Down Expand Up @@ -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$
Expand Down

0 comments on commit 6e9f52a

Please sign in to comment.