Skip to content

Commit 6e4fb3b

Browse files
committed
Add a max results setting
1 parent aa026c0 commit 6e4fb3b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

autoload/ctrlp.vim

+5-1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ fu! s:match_window_opts()
259259
\ s:mw =~ 'min:[^,]\+' ? str2nr(matchstr(s:mw, 'min:\zs\d\+')) : 1
260260
let [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])]
261261
let s:mw_min = min([s:mw_min, s:mw_max])
262+
let s:mw_res =
263+
\ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+'))
264+
\ : min([s:mw_max, &lines])
265+
let s:mw_res = max([s:mw_res, 1])
262266
endf
263267
"}}}1
264268
" * Open & Close {{{1
@@ -576,7 +580,7 @@ fu! s:Update(str)
576580
let s:martcs = &scs && str =~ '\u' ? '\C' : ''
577581
let pat = s:matcher == {} ? s:SplitPattern(str) : str
578582
let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines)
579-
\ : s:MatchedItems(g:ctrlp_lines, pat, s:winmaxh)
583+
\ : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res)
580584
cal s:Render(lines, pat)
581585
endf
582586

doc/ctrlp.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ heights of the match window: >
123123
let g:ctrlp_match_window = ''
124124
<
125125
Example: >
126-
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10'
126+
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10'
127127
<
128128
The position: (default: bottom)
129129
top - show the match window at the top of the screen.
@@ -137,6 +137,9 @@ The minimum and maximum heights:
137137
min:{n} - show minimum {n} lines (default: 1).
138138
max:{n} - show maximum {n} lines (default: 10).
139139

140+
The maximum number of results:
141+
results:{n} - list maximum {n} results (default: sync with max height).
142+
140143
Note: When a setting isn't set, its default value will be used.
141144

142145
*'g:ctrlp_switch_buffer'*

0 commit comments

Comments
 (0)