Skip to content

Instantly share code, notes, and snippets.

@andreimaxim
Last active December 15, 2015 06:59
Show Gist options
  • Save andreimaxim/5219817 to your computer and use it in GitHub Desktop.
Save andreimaxim/5219817 to your computer and use it in GitHub Desktop.
let g:path_to_matcher = "/usr/local/bin/matcher"
let g:ctrlp_max_files = 25000
let ctrlp_filter_greps = "".
\ "egrep -iv '\\.(" .
\ "jar|class|swp|swo|log|so|o|pyc|as|fla|swf|jpe?g|png|gif|mo|po|wav|zip" .
\ ")$' | " .
\ "egrep -v '^(\\./)?(.git/|.hg/|.svn/)'"
if has("unix")
let g:ctrol_user_command = "" .
\ "find %s '(' -type f -or -type l ')' -maxdepth 15 -not -path '*/\\.*/*' | " .
\ ctrlp_filter_greps
endif
let g:ctrlp_match_func = { 'match': 'GoodMatch' }
function! GoodMatch(items, str, limit, mmode, ispath, crfile, regex)
" Create a cache file if not yet exists
let cachefile = ctrlp#utils#cachedir().'/matcher.cache'
if !( filereadable(cachefile) && a:items == readfile(cachefile) )
call writefile(a:items, cachefile)
endif
if !filereadable(cachefile)
return []
endif
" a:mmode is currently ignored. In the future, we should probably do
" something about that. the matcher behaves like "full-line".
let cmd = g:path_to_matcher.' --limit '.a:limit.' --manifest '.cachefile.' '
"if !( exists('g:ctrlp_dotfiles') && g:ctrlp_dotfiles )
let cmd = cmd.'--no-dotfiles '
"endif
let cmd = cmd.a:str
return split(system(cmd), "\n")
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment