From 9cf53d959b7f22bc496c214c9102c1de7687e446 Mon Sep 17 00:00:00 2001 From: Kien N Date: Wed, 11 Apr 2012 01:19:10 +0700 Subject: [PATCH] Add a few local vars --- autoload/ctrlp.vim | 17 +++++++++-------- autoload/ctrlp/changes.vim | 2 +- autoload/ctrlp/quickfix.vim | 2 +- autoload/ctrlp/undo.vim | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 09c328d..6f46cbb 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -206,7 +206,7 @@ fu! s:Close() exe s:winres[0] en 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 s:execextvar('exit') cal s:log(0) @@ -405,7 +405,7 @@ fu! s:Render(lines, pat) exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|' cal s:unmarksigns() cal s:remarksigns() - if exists('s:cline') && !exists('g:ctrlp_nolimit') + if exists('s:cline') && s:nolim != 1 cal cursor(s:cline, 1) en " Highlighting @@ -422,7 +422,7 @@ fu! s:Update(str) " Stop if the string's unchanged if str == oldstr && !empty(str) && !exists('s:force') | retu | en 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) cal s:Render(lines, pat) endf @@ -570,7 +570,7 @@ fu! s:PrtSelectMove(dir) let wht = winheight(0) let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'} 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 endf @@ -593,7 +593,7 @@ fu! s:PrtSelectJump(char, ...) let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]] en 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 en endf @@ -715,7 +715,6 @@ endf fu! s:ToggleType(dir) let max = len(g:ctrlp_ext_vars) + 2 let next = s:walker(max, s:itemtype, a:dir) - unl! g:ctrlp_nolimit cal ctrlp#syntax() cal ctrlp#setlines(next) cal s:PrtSwitcher() @@ -1406,11 +1405,13 @@ fu! s:modevar() let s:ispath = s:ispathitem() if !s:ispath | let s:byfname = 0 | en let s:mfunc = s:mfunc() + let s:nolim = s:getextvar('nolim') + let s:dosort = s:getextvar('sort') endf fu! s:dosort() - retu s:matcher == {} && ( ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') ) - \ || s:prompt != ['', '', ''] ) && s:getextvar('sort') + retu s:matcher == {} && ( ( s:itemtype != 2 && s:nolim != 1 ) + \ || s:prompt != ['', '', ''] ) && s:dosort endf fu! s:narrowable() diff --git a/autoload/ctrlp/changes.vim b/autoload/ctrlp/changes.vim index 1b1e992..6e82bef 100644 --- a/autoload/ctrlp/changes.vim +++ b/autoload/ctrlp/changes.vim @@ -18,6 +18,7 @@ cal add(g:ctrlp_ext_vars, { \ 'exit': 'ctrlp#changes#exit()', \ 'type': 'tabe', \ 'sort': 0, + \ 'nolim': 1, \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) @@ -63,7 +64,6 @@ fu! ctrlp#changes#init(original_bufnr, bufnr) endfo sil! exe 'noa hid b' a:original_bufnr let &swb = swb - let g:ctrlp_nolimit = 1 cal ctrlp#syntax() cal s:syntax() retu lines diff --git a/autoload/ctrlp/quickfix.vim b/autoload/ctrlp/quickfix.vim index 5be1fea..125cc05 100644 --- a/autoload/ctrlp/quickfix.vim +++ b/autoload/ctrlp/quickfix.vim @@ -17,6 +17,7 @@ cal add(g:ctrlp_ext_vars, { \ 'sname': 'qfx', \ 'type': 'line', \ 'sort': 0, + \ 'nolim': 1, \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) @@ -34,7 +35,6 @@ fu! s:syntax() endf " Public {{{1 fu! ctrlp#quickfix#init() - let g:ctrlp_nolimit = 1 cal s:syntax() retu map(getqflist(), 's:lineout(v:val)') endf diff --git a/autoload/ctrlp/undo.vim b/autoload/ctrlp/undo.vim index 871c674..3264ee8 100644 --- a/autoload/ctrlp/undo.vim +++ b/autoload/ctrlp/undo.vim @@ -19,6 +19,7 @@ cal add(g:ctrlp_ext_vars, { \ 'exit': 'ctrlp#undo#exit()', \ 'type': 'line', \ 'sort': 0, + \ 'nolim': 1, \ }) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) @@ -117,7 +118,6 @@ endf fu! ctrlp#undo#init() let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1] if empty(entries) | retu [] | en - let g:ctrlp_nolimit = 1 if !exists('s:lines') if s:undos[0] let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))