Skip to content

Commit 40ee62e

Browse files
authored
Merge pull request #601 from ydzhou/master
Improve CtrlP fuzzy finding results on large directories
2 parents 8150fdd + af9c8de commit 40ee62e

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

autoload/ctrlp.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
9595
\ 'brief_prompt': ['s:brfprt', 0],
9696
\ 'match_current_file': ['s:matchcrfile', 0],
9797
\ 'match_natural_name': ['s:matchnatural', 0],
98-
\ 'compare_lim': ['s:compare_lim', 3000],
98+
\ 'compare_lim': ['s:compare_lim', 0],
9999
\ 'bufname_mod': ['s:bufname_mod', ':t'],
100100
\ 'bufpath_mod': ['s:bufpath_mod', ':~:.:h'],
101101
\ 'formatline_func': ['s:flfunc', 's:formatline(v:val)'],
@@ -396,7 +396,7 @@ fu! ctrlp#files()
396396
en
397397
" Remove base directory
398398
cal ctrlp#rmbasedir(g:ctrlp_allfiles)
399-
if len(g:ctrlp_allfiles) <= s:compare_lim
399+
if !s:compare_lim || len(g:ctrlp_allfiles) <= s:compare_lim
400400
cal sort(g:ctrlp_allfiles, 'ctrlp#complen')
401401
en
402402
cal s:writecache(cafile)

doc/ctrlp.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,17 @@ Example: >
847847
848848
This is possible to change no-limit mode for match type "path".
849849

850+
*ctrlp_compare_lim*
851+
If your search directory has more number of files than this limit, no sorting
852+
will be performed for the first readout. You can improve CtrlP performance by
853+
setting this to a proper value, but no sorting on the first readout can reduce
854+
the quality of fuzzy finding results.
855+
Example:
856+
let g:ctrlp_compare_lim = 100
857+
858+
Set the value to 0 for unlimited sorting. Default is 0.
859+
860+
850861
===============================================================================
851862
COMMANDS *ctrlp-commands*
852863

0 commit comments

Comments
 (0)