Skip to content


Subversion checkout URL

You can clone with
Download ZIP


performance - ctrlp is being slow #529

korovkin opened this Issue · 2 comments

2 participants


i have a pretty large project with 100k files:

find . -type f | wc -l

when i use ctrl+p, it take a while to list the files which is expected.
but, when it's done listing, it works well as long as i type in only 4-5 letters...

Search strings that are longer, usually stall the UI for 3-5 seconds each...
what am i missing here?

i am on a brand new macbook pro with an ssd drive - top notch hw ;)


It's just Vimscript being slow when the list is too large. You'll have to employ an external matcher with g:ctrlp_match_func, preferably written in a faster language. Nothing else really helps.

@kien kien closed this

thanks for the tip!

i ended up doing this:
(I am not interested in the fuzzy finger, just grepping will do)

let g:ctrlp_match_func = { 'match': 'GrepMatch' }

function! GrepMatch(items, str, limit, mmode, ispath, crfile, regex)
let query = a:str
if query == ""
let query = "."

let cachefile = '.files'
if !filereadable(cachefile)
let files = split(system('find . -type f -name *.c -o -name *.m -o -name *.h -o -name *.mm -o -name *.cpp -o -name *.hh -o -name *.py -o -name *.java -o -name *.json -o -name *.plist -o -name *.rb -o -name *.pbxproj', "\n"))
call writefile(files, cachefile)

let cmd = 'cat .files | grep -i '
let cmd = cmd.query." | head -n 100"
echo cmd
return split(system(cmd), "\n")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.