Skip to content

Commit 3f1ba86

Browse files
committed
Ignore errors
1 parent 02d72d6 commit 3f1ba86

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

autoload/ctrlp.vim

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,17 @@ fu! s:CloseCustomFuncs()
425425
en
426426
endf
427427

428-
if has('patch-8.2-0995')
428+
if has('patch-8.2-0995') && get(g:, 'ctrlp_use_readdir', 1)
429429
fu! s:GlobPath(dirs, depth)
430430
let entries = []
431431
let dirs = substitute(a:dirs, '\\\([%# ]\)', '\1', 'g')
432432
for e in split(dirs, ',')
433-
sil let files = readdir(e, '1', {'sort': 'none'})
434-
if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en
435-
let entries += map(files, 'e.s:lash.v:val')
433+
try
434+
let files = readdir(e, '1', {'sort': 'none'})
435+
if !s:showhidden | cal filter(files, 'v:val[0] != "."') | en
436+
let entries += map(files, 'e.s:lash.v:val')
437+
cat
438+
endt
436439
endfo
437440
let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1]
438441
if &wig != '' | cal filter(dnf[1], 'glob(v:val) != ""') | en

doc/ctrlp.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,13 @@ Example: >
846846
*'g:ctrlp_brief_prompt'*
847847
When this is set to 1, the <bs> on empty prompt exit CtrlP.
848848

849+
*'g:ctrlp_use_readdir'*
850+
Unlike kien/ctrlp.vim, ctrlpvim/ctrlp.vim uses readdir() instead of globpath()
851+
for speed. Set this option to 0 if you want to revert to the original
852+
behavior.
853+
Example: >
854+
let g:ctrlp_use_readdir = 0
855+
<
849856
*ctrlp-default-value*
850857
Otherwise, you can use below to change default value.
851858
Example: >

0 commit comments

Comments
 (0)