From 99b8798484cd18e34d5a1cf084644d1e5ca20d93 Mon Sep 17 00:00:00 2001 From: leiming Date: Mon, 31 Mar 2014 16:20:14 +0800 Subject: [PATCH 1/3] Finished bundle directory --- autoload/vundle/config.vim | 29 +++++++++++++++++++---------- autoload/vundle/installer.vim | 6 +++--- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 7bcf647..b2c5e98 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -6,6 +6,13 @@ func! vundle#config#bundle(arg, ...) return bundle endf +func! vundle#config#unbundle(arg, ...) + let g:aabundle = vundle#config#init_bundle(a:arg, a:000) + let g:name=g:aabundle.name_spec + let g:unbundle=vundle#installer#get_bundle_dir(g:bundles, g:name) +endf + + func! vundle#config#init() if !exists('g:bundles') | let g:bundles = [] | endif call s:rtp_rm_a() @@ -16,9 +23,9 @@ func! vundle#config#require(bundles) abort for b in a:bundles call s:rtp_add(b.rtpath) call s:rtp_add(g:bundle_dir) - " TODO: it has to be relative rtpath, not bundle.name - exec 'runtime! '.b.name.'/plugin/*.vim' - exec 'runtime! '.b.name.'/after/*.vim' + " Use absolute rtpath + exec 'runtime! '.b.rtpath.'/plugin/*.vim' + exec 'runtime! '.b.rtpath.'/after/*.vim' call s:rtp_rm(g:bundle_dir) endfor endf @@ -34,13 +41,14 @@ func! vundle#config#init_bundle(name, opts) endf func! s:parse_options(opts) - " TODO: improve this - if len(a:opts) != 1 | return {} | endif + if type(a:opts) == type({}) + return a:opts + endif - if type(a:opts[0]) == type({}) - return a:opts[0] - else - return {'rev': a:opts[0]} + if type(a:opts) == type([]) && len(a:opts) == 1 + return type(a:opts[0]) == type({}) ? a:opts[0] : {'rev':a:opts[0]} + else + return {} endif endf @@ -104,6 +112,7 @@ endf let s:bundle = {} func! s:bundle.path() - return s:expand_path(g:bundle_dir.'/'.self.name) + let a:bundle_dir = has_key(self, "bundle_dir") ? self.bundle_dir : g:bundle_dir + return s:expand_path(a:bundle_dir.'/'.self.name) endf diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 7fdc5f3..a16ea39 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -4,7 +4,7 @@ func! vundle#installer#new(bang, ...) abort \ map(copy(a:000), 'vundle#config#bundle(v:val, {})') let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec')) - call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:bundle_dir, 1)], names + ['Helptags']) + call vundle#scripts#view('Installer',['" Installing bundles to '.expand(g:bundle_dir, 1)], names + ['Helptags']) call s:process(a:bang, (a:bang ? 'add!' : 'add')) @@ -30,7 +30,7 @@ func! s:process(bang, cmd) endif if 'updated' == g:vundle_last_status && empty(msg) - let msg = 'Plugins updated; press u to view changelog' + let msg = 'Bundles updated; press u to view changelog' endif " goto next one @@ -81,7 +81,7 @@ func! vundle#installer#run(func_name, name, ...) abort return status endf -func! s:sign(status) +func! s:sign(status) if (!has('signs')) return endif From f3605de5a4c90d2909d02dfd6b9fe21640daf1bc Mon Sep 17 00:00:00 2001 From: leiming Date: Mon, 31 Mar 2014 17:31:32 +0800 Subject: [PATCH 2/3] Add the description of bundle_dir modified: README.md modified: test/vimrc --- README.md | 4 +++- test/vimrc | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 95c5ec0..9d2bbd8 100644 --- a/README.md +++ b/README.md @@ -60,8 +60,10 @@ Plugin 'Lokaltog/vim-easymotion' Plugin 'tpope/vim-rails.git' " The sparkup vim script is in a subdirectory of this repo called vim. - " Pass the path to set the runtimepath properly. + " Pass the path to set the runtimepath inside the repo properly. Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} + " Pass the path to set the plugin's runtimepath dir. + Plugin 'joonty/vim-sauce', {'bundle_dir' : '~/plugin_dir/'} " scripts from http://vim-scripts.org/vim/scripts.html Plugin 'L9' Plugin 'FuzzyFinder' diff --git a/test/vimrc b/test/vimrc index 13dd2e2..1972b1d 100644 --- a/test/vimrc +++ b/test/vimrc @@ -51,6 +51,7 @@ Bundle '~/Dropbox/.gitrepos/utilz.vim.git' " with options Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'} Bundle 'matchit.zip', {'name': 'matchit'} +Plugin 'joonty/vim-sauce', {'bundle_dir' : '~/.vim/custom_bundle/'} " Camel case Bundle 'vim-scripts/RubySinatra' From 108935167d021fdbbc2d6bab936d445143a524c4 Mon Sep 17 00:00:00 2001 From: leiming Date: Mon, 31 Mar 2014 17:48:41 +0800 Subject: [PATCH 3/3] Remove irrelevant code --- autoload/vundle/config.vim | 7 ------- autoload/vundle/installer.vim | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index b2c5e98..0d7685f 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -6,13 +6,6 @@ func! vundle#config#bundle(arg, ...) return bundle endf -func! vundle#config#unbundle(arg, ...) - let g:aabundle = vundle#config#init_bundle(a:arg, a:000) - let g:name=g:aabundle.name_spec - let g:unbundle=vundle#installer#get_bundle_dir(g:bundles, g:name) -endf - - func! vundle#config#init() if !exists('g:bundles') | let g:bundles = [] | endif call s:rtp_rm_a() diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index a16ea39..7fdc5f3 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -4,7 +4,7 @@ func! vundle#installer#new(bang, ...) abort \ map(copy(a:000), 'vundle#config#bundle(v:val, {})') let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec')) - call vundle#scripts#view('Installer',['" Installing bundles to '.expand(g:bundle_dir, 1)], names + ['Helptags']) + call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:bundle_dir, 1)], names + ['Helptags']) call s:process(a:bang, (a:bang ? 'add!' : 'add')) @@ -30,7 +30,7 @@ func! s:process(bang, cmd) endif if 'updated' == g:vundle_last_status && empty(msg) - let msg = 'Bundles updated; press u to view changelog' + let msg = 'Plugins updated; press u to view changelog' endif " goto next one @@ -81,7 +81,7 @@ func! vundle#installer#run(func_name, name, ...) abort return status endf -func! s:sign(status) +func! s:sign(status) if (!has('signs')) return endif