add a loading progress indicator
This commit is contained in:
parent
ba50429f33
commit
7679b622e4
@ -130,11 +130,12 @@ func! s:List(dirs, allfiles)
|
||||
let entries_copy = deepcopy(entries)
|
||||
let alldirs = filter(entries, 'isdirectory(v:val)')
|
||||
let allfiles = filter(entries_copy, '!isdirectory(v:val)')
|
||||
cal extend(allfiles, a:allfiles)
|
||||
cal extend(allfiles, a:allfiles, 0)
|
||||
if empty(alldirs)
|
||||
let s:allfiles = allfiles
|
||||
else
|
||||
let dirs = join(alldirs, ',')
|
||||
cal s:progress(allfiles)
|
||||
cal s:List(dirs, allfiles)
|
||||
endif
|
||||
endfunc
|
||||
@ -254,7 +255,6 @@ func! s:GetMatchedItems(items, pats, limit) "{{{
|
||||
endfunc "}}}
|
||||
|
||||
func! s:SetupBlank() "{{{
|
||||
cal s:statusline()
|
||||
setf ctrlp
|
||||
setl bt=nofile
|
||||
setl bh=delete
|
||||
@ -276,6 +276,7 @@ func! s:SetupBlank() "{{{
|
||||
setl noudf
|
||||
setl cc=0
|
||||
endif
|
||||
redr
|
||||
endfunc "}}}
|
||||
|
||||
func! s:BufOpen(...) "{{{
|
||||
@ -744,11 +745,14 @@ func! s:statusline(...)
|
||||
let max = len(itemtypes) - 1
|
||||
let next = 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]
|
||||
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
|
||||
|
||||
func! s:matchsubstr(item, pat)
|
||||
@ -762,6 +766,11 @@ func! s:matchlists(item, lst)
|
||||
retu 1
|
||||
endfunc
|
||||
|
||||
func! s:progress(entries)
|
||||
exe 'setl stl=%#WarningMsg#\ '.len(a:entries).'\ %*\ '
|
||||
redr
|
||||
endfunc
|
||||
|
||||
func! s:syntax()
|
||||
syn match CtrlPNoEntries '^ == NO MATCHES ==$'
|
||||
syn match CtrlPNoEntries '^ == DISABLED ==$'
|
||||
@ -795,11 +804,12 @@ func! ctrlp#init(type, ...) "{{{
|
||||
else
|
||||
sil! cal ctrlp#SetWorkingPath()
|
||||
endif
|
||||
sil! cal s:SetLines(a:type)
|
||||
sil! cal s:BufOpen('ControlP')
|
||||
sil! cal s:SetupBlank()
|
||||
sil! cal s:MapKeys()
|
||||
sil! cal s:SetLines(a:type)
|
||||
sil! cal s:Renderer(s:lines)
|
||||
cal s:statusline()
|
||||
cal s:BuildPrompt()
|
||||
sil! cal s:syntax()
|
||||
endfunc "}}}
|
||||
|
Loading…
Reference in New Issue
Block a user