Refactor global variables into autoload variables.
All global variables that are not part of the public API (mentioned in the documentation) are turned into autoload variables. This is intended to give all global variables defined by Vundle.vim a common prefix. The variable g:default_git_proto is part of the public API and is therefor not changed. This is the only exception. Changed: g:bundle_dir -> vundle#bundle_dir g:bundles -> vundle#bundles g:updated_bundles -> vundle#updated_bundles g:vundle_lazy_load -> vundle#lazy_load g:vundle_log -> vundle#log Unchanged: g:default_git_proto
This commit is contained in:
@@ -10,11 +10,11 @@ func! vundle#config#bundle(arg, ...)
|
||||
if !s:check_bundle_name(bundle)
|
||||
return
|
||||
endif
|
||||
if exists('g:vundle_lazy_load') && g:vundle_lazy_load
|
||||
call add(g:bundles, bundle)
|
||||
if exists('g:vundle#lazy_load') && g:vundle#lazy_load
|
||||
call add(g:vundle#bundles, bundle)
|
||||
else
|
||||
call s:rtp_rm_a()
|
||||
call add(g:bundles, bundle)
|
||||
call add(g:vundle#bundles, bundle)
|
||||
call s:rtp_add_a()
|
||||
call s:rtp_add_defaults()
|
||||
endif
|
||||
@@ -40,9 +40,9 @@ endf
|
||||
" once.
|
||||
" ---------------------------------------------------------------------------
|
||||
func! vundle#config#init()
|
||||
if !exists('g:bundles') | let g:bundles = [] | endif
|
||||
if !exists('g:vundle#bundles') | let g:vundle#bundles = [] | endif
|
||||
call s:rtp_rm_a()
|
||||
let g:bundles = []
|
||||
let g:vundle#bundles = []
|
||||
let s:bundle_names = {}
|
||||
endf
|
||||
|
||||
@@ -55,11 +55,11 @@ endf
|
||||
func! vundle#config#require(bundles) abort
|
||||
for b in a:bundles
|
||||
call s:rtp_add(b.rtpath)
|
||||
call s:rtp_add(g:bundle_dir)
|
||||
call s:rtp_add(g:vundle#bundle_dir)
|
||||
" TODO: it has to be relative rtpath, not bundle.name
|
||||
exec 'runtime! '.b.name.'/plugin/*.vim'
|
||||
exec 'runtime! '.b.name.'/after/*.vim'
|
||||
call s:rtp_rm(g:bundle_dir)
|
||||
call s:rtp_rm(g:vundle#bundle_dir)
|
||||
endfor
|
||||
call s:rtp_add_defaults()
|
||||
endf
|
||||
@@ -180,7 +180,7 @@ endf
|
||||
" runtimepath.
|
||||
" ---------------------------------------------------------------------------
|
||||
func! s:rtp_rm_a()
|
||||
let paths = map(copy(g:bundles), 'v:val.rtpath')
|
||||
let paths = map(copy(g:vundle#bundles), 'v:val.rtpath')
|
||||
let prepends = join(paths, ',')
|
||||
let appends = join(paths, '/after,').'/after'
|
||||
exec 'set rtp-='.fnameescape(prepends)
|
||||
@@ -193,7 +193,7 @@ endf
|
||||
" runtimepath.
|
||||
" ---------------------------------------------------------------------------
|
||||
func! s:rtp_add_a()
|
||||
let paths = map(copy(g:bundles), 'v:val.rtpath')
|
||||
let paths = map(copy(g:vundle#bundles), 'v:val.rtpath')
|
||||
let prepends = join(paths, ',')
|
||||
let appends = join(paths, '/after,').'/after'
|
||||
exec 'set rtp^='.fnameescape(prepends)
|
||||
@@ -262,7 +262,7 @@ let s:bundle = {}
|
||||
" return -- the target location to clone this bundle to
|
||||
" ---------------------------------------------------------------------------
|
||||
func! s:bundle.path()
|
||||
return s:expand_path(g:bundle_dir.'/'.self.name)
|
||||
return s:expand_path(g:vundle#bundle_dir.'/'.self.name)
|
||||
endf
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user