Merge branch 'develop'

This commit is contained in:
Kien N 2011-09-09 10:32:37 +07:00
commit 70bab18506

View File

@ -126,19 +126,16 @@ endfunc
" ListAllFiles {{{ " ListAllFiles {{{
func! s:List(dirs, allfiles) func! s:List(dirs, allfiles)
" note: wildignore is ignored when using ** " note: wildignore is ignored when using **
let entries = split(globpath(a:dirs, '*'), '\n') let entries = split(globpath(a:dirs, '*'), '\n')
let entries_copy = deepcopy(entries) let entries_copy = deepcopy(entries)
let alldirs = filter(entries, 'isdirectory(v:val)') let alldirs = filter(entries, 'isdirectory(v:val)')
let allfiles = filter(entries_copy, '!isdirectory(v:val)') let allfiles = filter(entries_copy, '!isdirectory(v:val)')
if empty(allfiles) cal extend(allfiles, a:allfiles, 0)
let allfiles = a:allfiles
else
cal extend(allfiles, a:allfiles)
endif
if empty(alldirs) if empty(alldirs)
let s:allfiles = allfiles let s:allfiles = allfiles
else else
let dirs = join(alldirs, ',') let dirs = join(alldirs, ',')
cal s:progress(allfiles)
cal s:List(dirs, allfiles) cal s:List(dirs, allfiles)
endif endif
endfunc endfunc
@ -146,8 +143,11 @@ endfunc
func! s:ListAllFiles(path) func! s:ListAllFiles(path)
let cache_file = ctrlp#utils#cachefile() let cache_file = ctrlp#utils#cachefile()
if g:ctrlp_newcache || !filereadable(cache_file) || !s:caching if g:ctrlp_newcache || !filereadable(cache_file) || !s:caching
" get the files
cal s:List(a:path, []) cal s:List(a:path, [])
let allfiles = s:allfiles let allfiles = s:allfiles
unl s:allfiles
" remove base directory
let path = &ssl || !exists('+ssl') ? getcwd().'/' : substitute(getcwd(), '\', '\\\\', 'g').'\\' let path = &ssl || !exists('+ssl') ? getcwd().'/' : substitute(getcwd(), '\', '\\\\', 'g').'\\'
cal map(allfiles, 'substitute(v:val, path, "", "g")') cal map(allfiles, 'substitute(v:val, path, "", "g")')
let read_cache = 0 let read_cache = 0
@ -255,7 +255,6 @@ func! s:GetMatchedItems(items, pats, limit) "{{{
endfunc "}}} endfunc "}}}
func! s:SetupBlank() "{{{ func! s:SetupBlank() "{{{
cal s:statusline()
setf ctrlp setf ctrlp
setl bt=nofile setl bt=nofile
setl bh=delete setl bh=delete
@ -277,6 +276,7 @@ func! s:SetupBlank() "{{{
setl noudf setl noudf
setl cc=0 setl cc=0
endif endif
redr
endfunc "}}} endfunc "}}}
func! s:BufOpen(...) "{{{ func! s:BufOpen(...) "{{{
@ -745,11 +745,14 @@ func! s:statusline(...)
let max = len(itemtypes) - 1 let max = len(itemtypes) - 1
let next = itemtypes[s:walker(max, s:itemtype, 1, 1)][1] let next = itemtypes[s:walker(max, s:itemtype, 1, 1)][1]
let prev = itemtypes[s:walker(max, s:itemtype, -1, 1)][1] let prev = itemtypes[s:walker(max, s:itemtype, -1, 1)][1]
let regex = s:regexp ? '[regex]' : ''
let byfname = s:byfname ? '[file]' : '[path]'
let focus = s:Focus() ? '[prt]' : '[win]'
let item = itemtypes[s:itemtype][0] let item = itemtypes[s:itemtype][0]
exe 'setl stl='.focus.byfname.regex.'+-('.prev.')-[['.item.']]-('.next.')-+' let focus = s:Focus() ? 'prt' : 'win'
let byfname = s:byfname ? 'file' : 'path'
let regex = s:regexp ? '%#Conditional#\ regex\ %*' : ''
let focus = '%#MatchParen#\ '.focus.'\ %*'
let byfname = '%#Character#\ '.byfname.'\ %*'
let item = '%#Constant#\ '.item.'\ %*'
exe 'setl stl='.focus.byfname.regex.'\ +-<'.prev.'>-{'.item.'}-<'.next.'>-+'
endfunc endfunc
func! s:matchsubstr(item, pat) func! s:matchsubstr(item, pat)
@ -763,6 +766,11 @@ func! s:matchlists(item, lst)
retu 1 retu 1
endfunc endfunc
func! s:progress(entries)
exe 'setl stl=%#WarningMsg#\ '.len(a:entries).'\ %*\ '
redr
endfunc
func! s:syntax() func! s:syntax()
syn match CtrlPNoEntries '^ == NO MATCHES ==$' syn match CtrlPNoEntries '^ == NO MATCHES ==$'
syn match CtrlPNoEntries '^ == DISABLED ==$' syn match CtrlPNoEntries '^ == DISABLED ==$'
@ -796,11 +804,12 @@ func! ctrlp#init(type, ...) "{{{
else else
sil! cal ctrlp#SetWorkingPath() sil! cal ctrlp#SetWorkingPath()
endif endif
sil! cal s:SetLines(a:type)
sil! cal s:BufOpen('ControlP') sil! cal s:BufOpen('ControlP')
sil! cal s:SetupBlank() sil! cal s:SetupBlank()
sil! cal s:MapKeys() sil! cal s:MapKeys()
sil! cal s:SetLines(a:type)
sil! cal s:Renderer(s:lines) sil! cal s:Renderer(s:lines)
cal s:statusline()
cal s:BuildPrompt() cal s:BuildPrompt()
sil! cal s:syntax() sil! cal s:syntax()
endfunc "}}} endfunc "}}}