some clean up

This commit is contained in:
Kien N 2011-09-10 21:22:14 +07:00
parent ff2d7781ed
commit fe5af5807f
2 changed files with 12 additions and 12 deletions

View File

@ -146,10 +146,9 @@ func! s:List(dirs, allfiles)
cal extend(allfiles, a:allfiles, 0) cal extend(allfiles, a:allfiles, 0)
if empty(alldirs) if empty(alldirs)
let s:allfiles = allfiles let s:allfiles = allfiles
cal s:statusline()
else else
let dirs = join(alldirs, ',') let dirs = join(alldirs, ',')
cal s:progress(allfiles) cal s:progress(len(allfiles))
cal s:List(dirs, allfiles) cal s:List(dirs, allfiles)
endif endif
endfunc endfunc
@ -211,7 +210,7 @@ func! s:SplitPattern(str,...) "{{{
" remove the line number " remove the line number
let str = substitute(str, '\zs:\d*$', '', 'g') let str = substitute(str, '\zs:\d*$', '', 'g')
endif endif
" don't split but turn it into a patterns list with 1 entry " don't split
let array = [str] let array = [str]
elseif match(str, ':\d*$') >= 0 " If string contains :\d elseif match(str, ':\d*$') >= 0 " If string contains :\d
" get the line to jump to " get the line to jump to
@ -304,8 +303,7 @@ func! s:BufOpen(...) "{{{
let bufnum = bufnr(buf) let bufnum = bufnr(buf)
" Closing " Closing
if bufnum > 0 && bufwinnr(bufnum) > 0 if bufnum > 0 && bufwinnr(bufnum) > 0
exe bufwinnr(bufnum).'winc w' exe 'bw!' a:1
exe 'winc c'
if s:pinput != 2 && exists('g:CtrlP_cline') if s:pinput != 2 && exists('g:CtrlP_cline')
unl g:CtrlP_cline unl g:CtrlP_cline
endif endif
@ -376,6 +374,7 @@ func! s:Renderer(lines) "{{{
" Output to buffer " Output to buffer
if len(nls) >= 1 if len(nls) >= 1
setl cul setl cul
" don't sort
if index([2], s:itemtype) < 0 if index([2], s:itemtype) < 0
cal sort(nls, 's:compare') cal sort(nls, 's:compare')
endif endif
@ -413,9 +412,9 @@ endfunc "}}}
func! s:LinesFilter() "{{{ func! s:LinesFilter() "{{{
" tiny performance increase, but every little bit counts " tiny performance increase, but every little bit counts
if exists('g:CtrlP_prompt_prev') if exists('g:CtrlP_prompt_prev')
let prt = g:CtrlP_prompt let prt = g:CtrlP_prompt
let str = prt[0] . prt[1] . prt[2]
let prt_prev = g:CtrlP_prompt_prev let prt_prev = g:CtrlP_prompt_prev
let str = prt[0] . prt[1] . prt[2]
let str_prev = prt_prev[0] . prt_prev[1] . prt_prev[2] let str_prev = prt_prev[0] . prt_prev[1] . prt_prev[2]
endif endif
if exists('s:matcheditems') && len(s:matcheditems) < s:mxheight if exists('s:matcheditems') && len(s:matcheditems) < s:mxheight
@ -558,7 +557,7 @@ func! s:PrtSelectJump(char,...)
endfunc endfunc
func! s:PrtClearCache() func! s:PrtClearCache()
cal ctrlp#clearallcaches() cal ctrlp#clearcache()
cal s:SetLines(s:itemtype) cal s:SetLines(s:itemtype)
cal s:statusline() cal s:statusline()
cal s:BuildPrompt() cal s:BuildPrompt()
@ -831,8 +830,8 @@ func! s:matchsubstr(item, pat)
retu match(split(a:item, '[\/]\ze[^\/]\+$')[-1], a:pat) retu match(split(a:item, '[\/]\ze[^\/]\+$')[-1], a:pat)
endfunc endfunc
func! s:progress(entries) func! s:progress(len)
exe 'setl stl=%#Function#\ '.len(a:entries).'\ %*\ ' exe 'setl stl=%#Function#\ '.a:len.'\ %*\ '
redr redr
endfunc endfunc
@ -889,6 +888,7 @@ func! ctrlp#init(type, ...) "{{{
cal s:MapKeys() cal s:MapKeys()
cal s:SetLines(a:type) cal s:SetLines(a:type)
cal s:BuildPrompt() cal s:BuildPrompt()
cal s:statusline()
cal s:syntax() cal s:syntax()
endfunc "}}} endfunc "}}}

View File

@ -301,7 +301,7 @@ Once inside the prompt:
Open selected file in a 'horizontal' split Open selected file in a 'horizontal' split
<F5> <F5>
Refresh the match window and clear the cache. Refresh the match window.
<esc>, <esc>,
<c-c>, <c-c>,
@ -354,7 +354,7 @@ CHANGELOG
*ctrlp-update-2* *ctrlp-update-2*
Update #2~ Update #2~
+ Extended the behavior of |g:ctrlp_persistent_input| + Extended the behavior of |g:ctrlp_persistent_input|
+ New options: |g:ctrlp_dotfiles| + New option: |g:ctrlp_dotfiles|
+ New input format: '..' (section 5.d) + New input format: '..' (section 5.d)
+ New mapping: <F5>. + New mapping: <F5>.
+ New commands: |:CtrlPCurWD|, + New commands: |:CtrlPCurWD|,