Skip to content

Instantly share code, notes, and snippets.

@kien
Created December 23, 2011 14:26
Show Gist options
  • Save kien/1514338 to your computer and use it in GitHub Desktop.
Save kien/1514338 to your computer and use it in GitHub Desktop.
autoload/ctrlp/script.vim
" =============================================================================
" File: autoload/ctrlp/script.vim
" Description: Find loaded vimscripts (:scriptnames)
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Init {{{1
if exists('g:loaded_ctrlp_script') && g:loaded_ctrlp_script
fini
en
let g:loaded_ctrlp_script = 1
let s:script_var = {
\ 'init': 'ctrlp#script#init()',
\ 'accept': 'ctrlp#script#accept',
\ 'lname': 'loaded scripts',
\ 'sname': 'script',
\ 'type': 'path',
\ }
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
\ ? add(g:ctrlp_ext_vars, s:script_var) : [s:script_var]
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Public {{{1
fu! ctrlp#script#init()
redi => data
sil! scrip
redi END
retu map(split(data, "\n"), 'expand(matchstr(v:val, ''^\s*\d\+:\s\zs.*\ze$''), 1)')
endf
fu! ctrlp#script#accept(mode, str)
cal ctrlp#acceptfile(a:mode, a:str)
endf
fu! ctrlp#script#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment