From 6e4fb3b45faf96a7fb500d2920cfeeab24aa39fb Mon Sep 17 00:00:00 2001 From: Kien N Date: Wed, 24 Jul 2013 17:58:24 +0700 Subject: [PATCH] Add a max results setting --- autoload/ctrlp.vim | 6 +++++- doc/ctrlp.txt | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index a1afaf1..e16a755 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -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 @@ -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 diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index 47e0d8e..e697b93 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -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. @@ -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'*