Add a few local vars

This commit is contained in:
Kien N 2012-04-11 01:19:10 +07:00
parent cb25e84cce
commit 9cf53d959b
4 changed files with 12 additions and 11 deletions

View File

@ -206,7 +206,7 @@ fu! s:Close()
exe s:winres[0] exe s:winres[0]
en en
unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
\ s:mrbs g:ctrlp_nolimit \ s:mrbs
cal ctrlp#recordhist() cal ctrlp#recordhist()
cal s:execextvar('exit') cal s:execextvar('exit')
cal s:log(0) cal s:log(0)
@ -405,7 +405,7 @@ fu! s:Render(lines, pat)
exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|' exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|'
cal s:unmarksigns() cal s:unmarksigns()
cal s:remarksigns() cal s:remarksigns()
if exists('s:cline') && !exists('g:ctrlp_nolimit') if exists('s:cline') && s:nolim != 1
cal cursor(s:cline, 1) cal cursor(s:cline, 1)
en en
" Highlighting " Highlighting
@ -422,7 +422,7 @@ fu! s:Update(str)
" Stop if the string's unchanged " Stop if the string's unchanged
if str == oldstr && !empty(str) && !exists('s:force') | retu | en if str == oldstr && !empty(str) && !exists('s:force') | retu | en
let pat = s:matcher == {} ? s:SplitPattern(str) : str let pat = s:matcher == {} ? s:SplitPattern(str) : str
let lines = exists('g:ctrlp_nolimit') && empty(str) ? copy(g:ctrlp_lines) let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines)
\ : s:MatchedItems(g:ctrlp_lines, pat, s:winh) \ : s:MatchedItems(g:ctrlp_lines, pat, s:winh)
cal s:Render(lines, pat) cal s:Render(lines, pat)
endf endf
@ -570,7 +570,7 @@ fu! s:PrtSelectMove(dir)
let wht = winheight(0) let wht = winheight(0)
let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
exe 'keepj norm!' dirs[a:dir] exe 'keepj norm!' dirs[a:dir]
if !exists('g:ctrlp_nolimit') | let s:cline = line('.') | en if s:nolim != 1 | let s:cline = line('.') | en
if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en
endf endf
@ -593,7 +593,7 @@ fu! s:PrtSelectJump(char, ...)
let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
en en
keepj exe jmpln + 1 keepj exe jmpln + 1
if !exists('g:ctrlp_nolimit') | let s:cline = line('.') | en if s:nolim != 1 | let s:cline = line('.') | en
if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en
en en
endf endf
@ -715,7 +715,6 @@ endf
fu! s:ToggleType(dir) fu! s:ToggleType(dir)
let max = len(g:ctrlp_ext_vars) + 2 let max = len(g:ctrlp_ext_vars) + 2
let next = s:walker(max, s:itemtype, a:dir) let next = s:walker(max, s:itemtype, a:dir)
unl! g:ctrlp_nolimit
cal ctrlp#syntax() cal ctrlp#syntax()
cal ctrlp#setlines(next) cal ctrlp#setlines(next)
cal s:PrtSwitcher() cal s:PrtSwitcher()
@ -1406,11 +1405,13 @@ fu! s:modevar()
let s:ispath = s:ispathitem() let s:ispath = s:ispathitem()
if !s:ispath | let s:byfname = 0 | en if !s:ispath | let s:byfname = 0 | en
let s:mfunc = s:mfunc() let s:mfunc = s:mfunc()
let s:nolim = s:getextvar('nolim')
let s:dosort = s:getextvar('sort')
endf endf
fu! s:dosort() fu! s:dosort()
retu s:matcher == {} && ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') ) retu s:matcher == {} && ( ( s:itemtype != 2 && s:nolim != 1 )
\ || s:prompt != ['', '', ''] ) && s:getextvar('sort') \ || s:prompt != ['', '', ''] ) && s:dosort
endf endf
fu! s:narrowable() fu! s:narrowable()

View File

@ -18,6 +18,7 @@ cal add(g:ctrlp_ext_vars, {
\ 'exit': 'ctrlp#changes#exit()', \ 'exit': 'ctrlp#changes#exit()',
\ 'type': 'tabe', \ 'type': 'tabe',
\ 'sort': 0, \ 'sort': 0,
\ 'nolim': 1,
\ }) \ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
@ -63,7 +64,6 @@ fu! ctrlp#changes#init(original_bufnr, bufnr)
endfo endfo
sil! exe 'noa hid b' a:original_bufnr sil! exe 'noa hid b' a:original_bufnr
let &swb = swb let &swb = swb
let g:ctrlp_nolimit = 1
cal ctrlp#syntax() cal ctrlp#syntax()
cal s:syntax() cal s:syntax()
retu lines retu lines

View File

@ -17,6 +17,7 @@ cal add(g:ctrlp_ext_vars, {
\ 'sname': 'qfx', \ 'sname': 'qfx',
\ 'type': 'line', \ 'type': 'line',
\ 'sort': 0, \ 'sort': 0,
\ 'nolim': 1,
\ }) \ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
@ -34,7 +35,6 @@ fu! s:syntax()
endf endf
" Public {{{1 " Public {{{1
fu! ctrlp#quickfix#init() fu! ctrlp#quickfix#init()
let g:ctrlp_nolimit = 1
cal s:syntax() cal s:syntax()
retu map(getqflist(), 's:lineout(v:val)') retu map(getqflist(), 's:lineout(v:val)')
endf endf

View File

@ -19,6 +19,7 @@ cal add(g:ctrlp_ext_vars, {
\ 'exit': 'ctrlp#undo#exit()', \ 'exit': 'ctrlp#undo#exit()',
\ 'type': 'line', \ 'type': 'line',
\ 'sort': 0, \ 'sort': 0,
\ 'nolim': 1,
\ }) \ })
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
@ -117,7 +118,6 @@ endf
fu! ctrlp#undo#init() fu! ctrlp#undo#init()
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1] let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
if empty(entries) | retu [] | en if empty(entries) | retu [] | en
let g:ctrlp_nolimit = 1
if !exists('s:lines') if !exists('s:lines')
if s:undos[0] if s:undos[0]
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur'])) let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))