diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 20d88fc..487bcd3 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -25,11 +25,11 @@ endf func! vundle#install_bundles() silent source ~/.vimrc exec '!mkdir -p '.g:bundle_dir - for bundle in g:bundles | call bundle.install() | endfor + for bundle in g:bundles | call s:install(bundle) | endfor endf func! vundle#helptags() - for bundle in g:bundles | call bundle.helptags() | endfor + for bundle in g:bundles | call s:helptags(bundle) | endfor endf func! s:rtp_add(dir) @@ -62,35 +62,38 @@ func! s:parse_name(arg) return {'name': name, 'uri': uri } endf -let s:bundle = {} - -func! s:bundle.path() - return expand(g:bundle_dir.''.self.name) -endf - -func! s:bundle.rtpath() - return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path() -endf - - -func! s:bundle.helptags() - let dir = self.rtpath() +func! s:helptags(bundle) + let dir = a:bundle.rtpath() if isdirectory(dir.'/doc') && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags')) helptags `=dir.'/doc'` endif endf -func! s:bundle.sync() - let git_dir = self.path().'/.git' - echo self.name +func! s:require(bundle) + exec 'runtime '.bundle.rtpath().'/plugin/*.vim' +endf + +func! s:sync(bundle) + let git_dir = a:bundle.path().'/.git' + echo a:bundle.name if isdirectory(git_dir) - silent exec '!cd '.self.path().'; git pull' + silent exec '!cd '.a:bundle.path().'; git pull' else - silent exec '!git clone '.self.uri.' '.self.path() + silent exec '!git clone '.a:bundle.uri.' '.a:bundle.path() endif endf -func! s:bundle.install() - call self.sync() - call self.helptags() +func! s:install(bundle) + call s:sync(a:bundle) + call s:helptags(a:bundle) +endf + +let s:bundle = {} + +func! s:bundle.path() + return expand(g:bundle_dir.''.self.name) +endf + +func! s:bundle.rtpath() + return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path() endf