Skip to content

Commit

Permalink
Add a max results setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kien committed Jul 24, 2013
1 parent aa026c0 commit 6e4fb3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion autoload/ctrlp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ fu! s:match_window_opts()
\ s:mw =~ 'min:[^,]\+' ? str2nr(matchstr(s:mw, 'min:\zs\d\+')) : 1
let [s:mw_max, s:mw_min] = [max([s:mw_max, 1]), max([s:mw_min, 1])]
let s:mw_min = min([s:mw_min, s:mw_max])
let s:mw_res =
\ s:mw =~ 'results:[^,]\+' ? str2nr(matchstr(s:mw, 'results:\zs\d\+'))
\ : min([s:mw_max, &lines])
let s:mw_res = max([s:mw_res, 1])
endf
"}}}1
" * Open & Close {{{1
Expand Down Expand Up @@ -576,7 +580,7 @@ fu! s:Update(str)
let s:martcs = &scs && str =~ '\u' ? '\C' : ''
let pat = s:matcher == {} ? s:SplitPattern(str) : str
let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines)
\ : s:MatchedItems(g:ctrlp_lines, pat, s:winmaxh)
\ : s:MatchedItems(g:ctrlp_lines, pat, s:mw_res)
cal s:Render(lines, pat)
endf

Expand Down
5 changes: 4 additions & 1 deletion doc/ctrlp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ heights of the match window: >
let g:ctrlp_match_window = ''
<
Example: >
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10'
let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10'
<
The position: (default: bottom)
top - show the match window at the top of the screen.
Expand All @@ -137,6 +137,9 @@ The minimum and maximum heights:
min:{n} - show minimum {n} lines (default: 1).
max:{n} - show maximum {n} lines (default: 10).

The maximum number of results:
results:{n} - list maximum {n} results (default: sync with max height).

Note: When a setting isn't set, its default value will be used.

*'g:ctrlp_switch_buffer'*
Expand Down

1 comment on commit 6e4fb3b

@georgexsh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally found this after 5 years!

Please sign in to comment.