Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions autoload/ctrlp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()]))
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions doc/ctrlp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down