Skip unreadable files

Closes #7.
This commit is contained in:
Tim Pope 2014-02-20 22:30:02 -05:00
parent 039e2cd134
commit cb15ce1414
1 changed files with 2 additions and 1 deletions

View File

@ -117,10 +117,11 @@ function! s:detect() abort
while isdirectory(dir) && dir !=# fnamemodify(dir, ':h')
for pattern in patterns
for neighbor in split(glob(dir.'/'.pattern), "\n")
if neighbor !=# expand('%:p')
if neighbor !=# expand('%:p') && filereadable(neighbor)
call extend(options, s:guess(readfile(neighbor, '', 1024)), 'keep')
endif
if s:apply_if_ready(options)
let b:sleuth_culprit = neighbor
return
endif
endfor