bgneal@7: " ============================================================================= bgneal@7: " File: autoload/ctrlp/rtscript.vim bgneal@7: " Description: Runtime scripts extension bgneal@7: " Author: Kien Nguyen bgneal@7: " ============================================================================= bgneal@7: bgneal@7: " Init {{{1 bgneal@7: if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript bgneal@7: fini bgneal@7: en bgneal@7: let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0] bgneal@7: bgneal@7: cal add(g:ctrlp_ext_vars, { bgneal@7: \ 'init': 'ctrlp#rtscript#init()', bgneal@7: \ 'accept': 'ctrlp#acceptfile', bgneal@7: \ 'lname': 'runtime scripts', bgneal@7: \ 'sname': 'rts', bgneal@7: \ 'type': 'path', bgneal@7: \ 'opmul': 1, bgneal@7: \ }) bgneal@7: bgneal@7: let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) bgneal@7: " Public {{{1 bgneal@7: fu! ctrlp#rtscript#init() bgneal@7: if g:ctrlp_newrts bgneal@7: \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp ) bgneal@7: sil! cal ctrlp#progress('Indexing...') bgneal@7: let entries = split(globpath(&rtp, '**/*.*'), "\n") bgneal@7: cal filter(entries, 'count(entries, v:val) == 1') bgneal@7: let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1] bgneal@7: el bgneal@7: let [entries, results] = g:ctrlp_rtscache[2:3] bgneal@7: en bgneal@7: let cwd = getcwd() bgneal@7: if g:ctrlp_newrts bgneal@7: \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, cwd] ) bgneal@7: if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en bgneal@7: let results = map(copy(entries), 'fnamemodify(v:val, '':.'')') bgneal@7: en bgneal@7: let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, cwd, entries, results], 0] bgneal@7: retu results bgneal@7: endf bgneal@7: bgneal@7: fu! ctrlp#rtscript#id() bgneal@7: retu s:id bgneal@7: endf bgneal@7: "}}} bgneal@7: bgneal@7: " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2