Remix when MRU list changes
This commit is contained in:
parent
dfd54e1d33
commit
045b66a6ab
@ -28,7 +28,8 @@ let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|||||||
fu! s:newcache(cwd)
|
fu! s:newcache(cwd)
|
||||||
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
||||||
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
||||||
\ || g:ctrlp_allmixes['time'] < getftime(ctrlp#utils#cachefile())
|
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
|
||||||
|
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
|
||||||
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#mrufs())
|
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#mrufs())
|
||||||
endf
|
endf
|
||||||
|
|
||||||
@ -59,8 +60,9 @@ fu! s:getnewmix(cwd, clim)
|
|||||||
if len(g:ctrlp_lines) <= a:clim
|
if len(g:ctrlp_lines) <= a:clim
|
||||||
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
||||||
en
|
en
|
||||||
let g:ctrlp_allmixes = { 'time': getftime(ctrlp#utils#cachefile()),
|
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
|
||||||
\ 'cwd': a:cwd, 'bufs': len(ctrlp#mrufiles#mrufs()), 'data': g:ctrlp_lines }
|
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
|
||||||
|
\ 'bufs': len(ctrlp#mrufiles#mrufs()), 'data': g:ctrlp_lines }
|
||||||
endf
|
endf
|
||||||
" Public {{{1
|
" Public {{{1
|
||||||
fu! ctrlp#mixed#init(clim)
|
fu! ctrlp#mixed#init(clim)
|
||||||
|
@ -26,7 +26,7 @@ fu! s:excl(fn)
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:mergelists()
|
fu! s:mergelists()
|
||||||
let diskmrufs = s:readcache()
|
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
|
||||||
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
||||||
let mrufs = s:mrufs + diskmrufs
|
let mrufs = s:mrufs + diskmrufs
|
||||||
if v:version < 702 | cal filter(mrufs, 'count(mrufs, v:val) == 1') | en
|
if v:version < 702 | cal filter(mrufs, 'count(mrufs, v:val) == 1') | en
|
||||||
@ -38,14 +38,6 @@ fu! s:chop(mrufs)
|
|||||||
retu a:mrufs
|
retu a:mrufs
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:readcache()
|
|
||||||
if !exists('s:cadir') || !exists('s:cafile')
|
|
||||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
|
||||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
|
||||||
en
|
|
||||||
retu ctrlp#utils#readfile(s:cafile)
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! s:reformat(mrufs)
|
fu! s:reformat(mrufs)
|
||||||
if s:re
|
if s:re
|
||||||
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
||||||
@ -109,6 +101,14 @@ fu! ctrlp#mrufiles#mrufs()
|
|||||||
retu s:mrufs
|
retu s:mrufs
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#mrufiles#cachefile()
|
||||||
|
if !exists('s:cadir') || !exists('s:cafile')
|
||||||
|
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
||||||
|
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||||
|
en
|
||||||
|
retu s:cafile
|
||||||
|
endf
|
||||||
|
|
||||||
fu! ctrlp#mrufiles#init()
|
fu! ctrlp#mrufiles#init()
|
||||||
if !has('autocmd') | retu | en
|
if !has('autocmd') | retu | en
|
||||||
let s:locked = 0
|
let s:locked = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user