2012-01-06 01:22:55 -05:00
|
|
|
" =============================================================================
|
|
|
|
" File: autoload/ctrlp/rtscript.vim
|
2012-01-15 12:42:14 -05:00
|
|
|
" Description: Runtime scripts extension
|
2012-01-06 01:22:55 -05:00
|
|
|
" Author: Kien Nguyen <github.com/kien>
|
|
|
|
" =============================================================================
|
|
|
|
|
|
|
|
" Init {{{1
|
|
|
|
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
|
|
|
fini
|
|
|
|
en
|
|
|
|
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
|
|
|
|
2012-01-15 12:42:14 -05:00
|
|
|
let s:rtscript_var = {
|
|
|
|
\ 'init': 'ctrlp#rtscript#init()',
|
|
|
|
\ 'accept': 'ctrlp#rtscript#accept',
|
|
|
|
\ 'lname': 'runtime scripts',
|
|
|
|
\ 'sname': 'rts',
|
|
|
|
\ 'type': 'path',
|
|
|
|
\ }
|
2012-01-06 01:22:55 -05:00
|
|
|
|
|
|
|
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
|
|
|
|
\ ? add(g:ctrlp_ext_vars, s:rtscript_var) : [s:rtscript_var]
|
|
|
|
|
|
|
|
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
|
|
|
" Public {{{1
|
|
|
|
fu! ctrlp#rtscript#init()
|
|
|
|
if g:ctrlp_newrts || !exists('g:ctrlp_rtscache')
|
2012-01-15 12:42:14 -05:00
|
|
|
sil! cal ctrlp#progress('Indexing...')
|
2012-01-21 23:48:44 -05:00
|
|
|
let entries = split(globpath(&rtp, '**/*.*'), "\n")
|
|
|
|
cal filter(entries,'index(entries, v:val, v:key + 1) < 0')
|
2012-01-06 01:22:55 -05:00
|
|
|
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [ctrlp#dirnfile(entries)[1], 0]
|
|
|
|
en
|
|
|
|
retu g:ctrlp_rtscache
|
|
|
|
endf
|
|
|
|
|
|
|
|
fu! ctrlp#rtscript#accept(mode, str)
|
|
|
|
cal ctrlp#acceptfile(a:mode, a:str)
|
|
|
|
endf
|
|
|
|
|
|
|
|
fu! ctrlp#rtscript#id()
|
|
|
|
retu s:id
|
|
|
|
endf
|
|
|
|
"}}}
|
|
|
|
|
|
|
|
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|