diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index c8f5e1bc..7055d5d5 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -678,6 +678,7 @@ fu! s:MatchedItems(items, pat, limit) \ 'ispath': s:ispath, \ 'crfile': exc, \ 'regex': s:regexp, + \ 'nosort': s:matchernosort(), \ }] : [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp] let lines = call(matcher['match'], argms, matcher) el @@ -739,7 +740,7 @@ fu! s:Render(lines, pat) en let s:matched = copy(lines) " Sorting - if !s:nosort() + if !s:rendernosort() let s:compat = s:martcs.pat if has('patch-8.1-0') cal sort(lines, function('s:mixedsort2', [s:curtype()])) @@ -2347,12 +2348,16 @@ fu! s:modevar() let s:spi = !s:itemtype || s:getextvar('specinput') > 0 endf -fu! s:nosort() +fu! s:matchernosort() let ct = s:curtype() - retu s:matcher != {} || s:nolim == 1 || ( ct == 'mru' && s:mrudef ) + retu ( ct == 'mru' && s:mrudef ) \ || ( ct =~ '^\(buf\|mru\)$' && s:prompt == ['', '', ''] ) || !s:dosort endf +fu! s:rendernosort() + retu s:matcher != {} || s:nolim == 1 || s:matchernosort() +endf + fu! s:byfname() retu s:curtype() != 'buf' && s:ispath && s:byfname endf diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index 82eecfcb..f5c57460 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -818,6 +818,12 @@ Structure of the function: > " | results when a:ispath == 1. " | " +- a:regex : In regex mode: 1 or 0. + " | + " +- a:nosort : No sort: 1 or 0. Sorting may be disabled for some plugins. + " | Match function should keep item order when a:nosort == 1. + " | Only available when function is called with a dictionary, + " | see note below. + return list_of_matched_items endfunction