Enable plugins without restarting Vim!

This commit is contained in:
gmarik 2010-12-08 21:26:38 -06:00
parent cf68545caa
commit 8955c848cb

View File

@ -9,8 +9,12 @@ com! -nargs=0 BundleDocs call vundle#helptags()
com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>) com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search("<bang>", <q-args>)
if !exists('g:bundles') | let g:bundles = [] | endif
func! vundle#rc() func! vundle#rc()
let g:bundle_dir = expand('$HOME/.vim/bundle/') let g:bundle_dir = expand('$HOME/.vim/bundle')
call filter(g:bundles, 's:rtp_rm(v:val.rtpath())')
call s:rtp_rm(g:bundle_dir)
let g:bundles = [] let g:bundles = []
endf endf
@ -19,6 +23,8 @@ func! vundle#add_bundle(arg, ...)
call extend(bundle, copy(s:bundle)) call extend(bundle, copy(s:bundle))
call add(g:bundles, bundle) call add(g:bundles, bundle)
call s:rtp_add(bundle.rtpath()) call s:rtp_add(bundle.rtpath())
call s:rtp_add(g:bundle_dir)
exec 'runtime! '.bundle.name.'/plugin/*.vim'
endf endf
func! vundle#install_bundles(bang) func! vundle#install_bundles(bang)
@ -33,13 +39,6 @@ func! vundle#helptags()
echo 'Done. '.c.' bundles processed' echo 'Done. '.c.' bundles processed'
endf endf
func! s:rtp_add(dir)
exec 'set rtp^='.a:dir
let after = expand(a:dir.'/after') | if isdirectory(after)
exec 'set rtp+='.after
endif
endf
func! s:parse_options(opts) func! s:parse_options(opts)
" TODO: improve this " TODO: improve this
if len(a:opts) != 1 | return {} | endif if len(a:opts) != 1 | return {} | endif
@ -88,10 +87,20 @@ func! s:install(bang, bundle)
call s:helptags(a:bundle.rtpath()) call s:helptags(a:bundle.rtpath())
endf endf
func! s:rtp_rm(dir)
exec 'set rtp-='.a:dir
exec 'set rtp-='.expand(a:dir.'/after')
endf
func! s:rtp_add(dir)
exec 'set rtp^='.a:dir
exec 'set rtp+='.expand(a:dir.'/after')
endf
let s:bundle = {} let s:bundle = {}
func! s:bundle.path() func! s:bundle.path()
return expand(g:bundle_dir.''.self.name) return join([g:bundle_dir, self.name], '/')
endf endf
func! s:bundle.rtpath() func! s:bundle.rtpath()