Skip to content

Commit

Permalink
Inclusion filtering for cache files deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
kien committed Apr 13, 2013
1 parent 6a06525 commit 693f4d6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions autoload/ctrlp.vim
Expand Up @@ -319,7 +319,7 @@ fu! ctrlp#clra()
if isdirectory(cadir) if isdirectory(cadir)
let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n") let cafiles = split(s:glbpath(s:fnesc(cadir, 'g', ','), '**', 1), "\n")
let eval = '!isdirectory(v:val) && v:val !~ ''\v[\/]cache[.a-z]+$|\.log$''' let eval = '!isdirectory(v:val) && v:val !~ ''\v[\/]cache[.a-z]+$|\.log$'''
sil! cal map(filter(cafiles, eval), 'delete(v:val)') sil! cal map(s:ifilter(cafiles, eval), 'delete(v:val)')
en en
cal ctrlp#clr() cal ctrlp#clr()
endf endf
Expand Down Expand Up @@ -1628,6 +1628,18 @@ fu! s:dosigns()
retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs') retu exists('s:marked') && s:bufnr > 0 && s:opmul != '0' && has('signs')
endf endf
" Lists & Dictionaries {{{2 " Lists & Dictionaries {{{2
fu! s:ifilter(list, str)
let [rlist, estr] = [[], substitute(a:str, 'v:val', 'each', 'g')]
for each in a:list
try
if eval(estr)
cal add(rlist, each)
en
cat | con | endt
endfo
retu rlist
endf

fu! s:dictindex(dict, expr) fu! s:dictindex(dict, expr)
for key in keys(a:dict) for key in keys(a:dict)
if a:dict[key] == a:expr | retu key | en if a:dict[key] == a:expr | retu key | en
Expand Down Expand Up @@ -1968,7 +1980,8 @@ endf
fu! s:log(m) fu! s:log(m)
if exists('g:ctrlp_log') && g:ctrlp_log | if a:m if exists('g:ctrlp_log') && g:ctrlp_log | if a:m
let cadir = ctrlp#utils#cachedir() let cadir = ctrlp#utils#cachedir()
sil! exe 'redi! >' cadir.s:lash(cadir).'ctrlp.log' let apd = g:ctrlp_log > 1 ? '>' : ''
sil! exe 'redi! >'.apd cadir.s:lash(cadir).'ctrlp.log'
el el
sil! redi END sil! redi END
en | en en | en
Expand Down

0 comments on commit 693f4d6

Please sign in to comment.