annotate vim/vimfiles/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim @ 11:d428a965f322

Added a mapping/function to edit a file's other part (header/impl).
author Brian Neal <bgneal1@rockwellcollins.com>
date Mon, 04 Feb 2013 14:12:18 -0600
parents 86e0ac713642
children
rev   line source
bgneal@7 1 " =============================================================================
bgneal@7 2 " File: autoload/ctrlp/rtscript.vim
bgneal@7 3 " Description: Runtime scripts extension
bgneal@7 4 " Author: Kien Nguyen <github.com/kien>
bgneal@7 5 " =============================================================================
bgneal@7 6
bgneal@7 7 " Init {{{1
bgneal@7 8 if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
bgneal@7 9 fini
bgneal@7 10 en
bgneal@7 11 let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
bgneal@7 12
bgneal@7 13 cal add(g:ctrlp_ext_vars, {
bgneal@7 14 \ 'init': 'ctrlp#rtscript#init()',
bgneal@7 15 \ 'accept': 'ctrlp#acceptfile',
bgneal@7 16 \ 'lname': 'runtime scripts',
bgneal@7 17 \ 'sname': 'rts',
bgneal@7 18 \ 'type': 'path',
bgneal@7 19 \ 'opmul': 1,
bgneal@7 20 \ })
bgneal@7 21
bgneal@7 22 let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
bgneal@7 23 " Public {{{1
bgneal@7 24 fu! ctrlp#rtscript#init()
bgneal@7 25 if g:ctrlp_newrts
bgneal@7 26 \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
bgneal@7 27 sil! cal ctrlp#progress('Indexing...')
bgneal@7 28 let entries = split(globpath(&rtp, '**/*.*'), "\n")
bgneal@7 29 cal filter(entries, 'count(entries, v:val) == 1')
bgneal@7 30 let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
bgneal@7 31 el
bgneal@7 32 let [entries, results] = g:ctrlp_rtscache[2:3]
bgneal@7 33 en
bgneal@7 34 let cwd = getcwd()
bgneal@7 35 if g:ctrlp_newrts
bgneal@7 36 \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, cwd] )
bgneal@7 37 if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
bgneal@7 38 let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
bgneal@7 39 en
bgneal@7 40 let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, cwd, entries, results], 0]
bgneal@7 41 retu results
bgneal@7 42 endf
bgneal@7 43
bgneal@7 44 fu! ctrlp#rtscript#id()
bgneal@7 45 retu s:id
bgneal@7 46 endf
bgneal@7 47 "}}}
bgneal@7 48
bgneal@7 49 " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2