From 1953dcd2eeeb0124b7f0c7f8623bfad46509f47d Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 16 Jul 2014 21:46:17 -0400 Subject: [PATCH 01/14] Clarify Readme. - closes #281 --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b8a7fdbc..13d4eb67 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,10 @@ "filetype plugin on " " Brief help - " :PluginList - list configured plugins - " :PluginInstall(!) - install (update) plugins - " :PluginSearch(!) foo - search (or refresh cache first) for foo - " :PluginClean(!) - confirm (or auto-approve) removal of unused plugins + " :PluginList - lists configured plugins + " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate + " :PluginSearch foo - searches for foo; append `!` to refresh local cache + " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line From dbc36fcaae8b03345672c5411d17cda22aceb652 Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Tue, 26 Aug 2014 11:00:55 -0400 Subject: [PATCH 02/14] Update minirc to Plugin namespace --- test/minirc.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/minirc.vim b/test/minirc.vim index 3c24395b..7b48d132 100644 --- a/test/minirc.vim +++ b/test/minirc.vim @@ -2,7 +2,8 @@ set nocompatible syntax on filetype off set rtp+=~/.vim/bundle/Vundle.vim/ -call vundle#rc() -Bundle 'gmarik/Vundle.vim' +call vundle#begin() +Plugin 'gmarik/Vundle.vim' +call vundle#end() filetype plugin indent on From 55db8cc492ac5bafbd7302026839c8980cf6e7a7 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Mon, 8 Sep 2014 15:45:39 +0800 Subject: [PATCH 03/14] Use svg instead of png to get better image quality --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13d4eb67..fcd5f681 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ [Vundle] is undergoing an [interface change], please stay up to date to get latest changes. -[![Gitter-chat](https://badges.gitter.im/gmarik/Vundle.vim.png)](https://gitter.im/gmarik/Vundle.vim) for discussion and support. +[![Gitter-chat](https://badges.gitter.im/gmarik/Vundle.vim.svg)](https://gitter.im/gmarik/Vundle.vim) for discussion and support. ![Vundle-installer](http://i.imgur.com/Rueh7Cc.png) From a864467285fc419c5f652c740137fbfb8ffeaa32 Mon Sep 17 00:00:00 2001 From: Jacobo de Vera Date: Fri, 20 Feb 2015 07:01:53 +0100 Subject: [PATCH 04/14] Add explicit note for Fish users to check the FAQ --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 13d4eb67..900253cd 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ If you are using Windows, go directly to [Windows setup]. If you run into any issues, please consult the [FAQ]. See [Tips] for some advanced configurations. + Using non-POSIX shells, such as the popular Fish shell, requires additional setup. Please check the [FAQ]. + 2. Set up [Vundle]: `$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim` From 1df432aecfc0dacd93a1da0938830206f418fd66 Mon Sep 17 00:00:00 2001 From: Shahaf Arad Date: Mon, 16 Feb 2015 20:03:37 +0200 Subject: [PATCH 05/14] Allow updating specific plugins. --- autoload/vundle.vim | 6 +++--- autoload/vundle/installer.vim | 18 +++++++++++++++--- autoload/vundle/scripts.vim | 7 ++++++- doc/vundle.txt | 18 ++++++++++++++++-- 4 files changed, 40 insertions(+), 9 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 29390483..887ecddf 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -8,8 +8,8 @@ com! -nargs=+ -bar Plugin \ call vundle#config#bundle() -com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginInstall -\ call vundle#installer#new('!' == '', ) +com! -nargs=* -bang -complete=custom,vundle#scripts#complete PluginInstall +\ call vundle#installer#new('!' == '', ) com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginSearch \ call vundle#scripts#all('!' == '', ) @@ -24,7 +24,7 @@ com! -nargs=0 PluginDocs \ call vundle#installer#helptags(g:bundles) " Aliases -com! PluginUpdate PluginInstall! +com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! " Vundle Aliases com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall PluginInstall diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 614b64bd..6797d1d4 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -6,9 +6,21 @@ " ... -- any number of bundle specifications (separate arguments) " --------------------------------------------------------------------------- func! vundle#installer#new(bang, ...) abort - let bundles = (a:1 == '') ? - \ g:bundles : - \ map(copy(a:000), 'vundle#config#bundle(v:val, {})') + " No specific plugins are specified. Operate on all plugins. + if a:0 == 0 + let bundles = g:bundles + " Specific plugins are specified for update. Update them. + elseif (a:bang) + let bundles = filter(copy(g:bundles), 'index(a:000, v:val.name) > -1') + " Specific plugins are specified for installation. Install them. + else + let bundles = map(copy(a:000), 'vundle#config#bundle(v:val, {})') + endif + + if empty(bundles) + echoerr 'No bundles were selected for operation' + return + endif 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']) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index d7409a10..f160e01f 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -39,7 +39,12 @@ endf " candidates, see also :h command-completion-custom " --------------------------------------------------------------------------- func! vundle#scripts#complete(a,c,d) - return join(s:load_scripts(0),"\n") + " Return only installed plugins if updating + if match(a:c, '\v^Plugin%(Install!|Update)') == 0 + return join(map(copy(g:bundles), 'v:val.name'), "\n") + else + return join(s:load_scripts(0),"\n") + endif endf diff --git a/doc/vundle.txt b/doc/vundle.txt index 198584bc..9a2670a4 100644 --- a/doc/vundle.txt +++ b/doc/vundle.txt @@ -244,8 +244,16 @@ PluginInstall allows installation of plugins by name: > :PluginInstall unite.vim -Installs and activates unite.vim. You can use Tab to auto-complete known -script names. Note that the installation just described isn't permanent. To +Installs and activates unite.vim. + +PluginInstall also allows installation of several plugins separated by space. +> + :PluginInstall tpope/vim-surround tpope/vim-fugitive + +Installs both tpope/vim-surround and tpope/vim-fugitive from GitHub. + +You can use Tab to auto-complete known script names. +Note that the installation just described isn't permanent. To finish, you must put `Plugin 'unite.vim'` at the appropriate place in your `.vimrc` to tell Vundle to load the plugin at startup. @@ -263,6 +271,12 @@ Installs or updates the configured plugins. Press 'u' after updates complete to see the change log of all updated bundles. Press 'l' (lowercase 'L') to see the log of commands if any errors occurred. +To update specific plugins, write their names separated by space: +> + :PluginInstall! vim-surround vim-fugitive +or > + :PluginUpdate vim-surround vim-fugitive + 3.5 SEARCHING PLUGINS ~ *vundle-plugins-search* *:PluginSearch* > From 92a66df592c3562fb39714a3531d8494279b1f6a Mon Sep 17 00:00:00 2001 From: Jacobo de Vera Date: Mon, 2 Mar 2015 22:02:44 +0100 Subject: [PATCH 06/14] Complete installed plugins also for VundleUpdate --- autoload/vundle.vim | 1 + autoload/vundle/scripts.vim | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 887ecddf..dded571d 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -32,6 +32,7 @@ com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleSearch Plugi com! -nargs=? -bang VundleClean PluginClean com! -nargs=0 VundleDocs PluginDocs com! VundleUpdate PluginInstall! +com! -nargs=* -complete=custom,vundle#scripts#complete VundleUpdate PluginInstall! " Deprecated Commands com! -nargs=+ Bundle call vundle#config#bundle() diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f160e01f..4a066fbb 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -36,13 +36,15 @@ endf " " a, c, d -- see :h command-completion-custom " return -- all valid plugin names from vim-scripts.org as completion -" candidates, see also :h command-completion-custom +" candidates, or all installed plugin names when running an 'Update +" variant'. see also :h command-completion-custom " --------------------------------------------------------------------------- func! vundle#scripts#complete(a,c,d) - " Return only installed plugins if updating - if match(a:c, '\v^Plugin%(Install!|Update)') == 0 + if match(a:c, '\v^%(Plugin|Vundle)%(Install!|Update)') == 0 + " Only installed plugins if updating return join(map(copy(g:bundles), 'v:val.name'), "\n") else + " Or all known plugins otherwise return join(s:load_scripts(0),"\n") endif endf From 7d9b10874e374f0db4ae47aa55e49033174bbf50 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Mon, 28 Apr 2014 12:14:18 +0200 Subject: [PATCH 07/14] Allow multiple calls to VundleChangelog. The command `silent pedit ...` was causing trouble if the user had `set hidden`. Now we `bdelete` the changelog buffer before editing it anew. --- autoload/vundle/scripts.vim | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 4a066fbb..f9f23554 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -70,6 +70,7 @@ endf " user. " --------------------------------------------------------------------------- func! s:create_changelog() abort + let changelog = ['Updated Plugins:'] for bundle_data in g:updated_bundles let initial_sha = bundle_data[0] let updated_sha = bundle_data[1] @@ -83,18 +84,19 @@ func! s:create_changelog() abort let updates = system(cmd) - call add(g:vundle_changelog, '') - call add(g:vundle_changelog, 'Updated Plugin: '.bundle.name) + call add(changelog, '') + call add(changelog, 'Updated Plugin: '.bundle.name) if bundle.uri =~ "https://github.com" - call add(g:vundle_changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha) + call add(changelog, 'Compare at: '.bundle.uri[0:-5].'/compare/'.initial_sha.'...'.updated_sha) endif for update in split(updates, '\n') let update = substitute(update, '\s\+$', '', '') - call add(g:vundle_changelog, ' '.update) + call add(changelog, ' '.update) endfor endfor + return changelog endf @@ -102,14 +104,15 @@ endf " View the change log after an update or installation. " --------------------------------------------------------------------------- func! s:view_changelog() - call s:create_changelog() - - if !exists('g:vundle_changelog_file') - let g:vundle_changelog_file = tempname() + if !exists('s:changelog_file') + let s:changelog_file = tempname() endif - call writefile(g:vundle_changelog, g:vundle_changelog_file) - execute 'silent pedit ' . g:vundle_changelog_file + if bufloaded(s:changelog_file) + execute 'silent bdelete' s:changelog_file + endif + call writefile(s:create_changelog(), s:changelog_file) + execute 'silent pedit' s:changelog_file wincmd P | wincmd H endf From cad5f50a64ddae6a0c6c068b260d48904f12694c Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 3 Mar 2015 10:40:30 +0100 Subject: [PATCH 08/14] Remove unneeded variable setting. The variable is script local to autoload/vundle/scripts.vim since #468. --- autoload/vundle.vim | 1 - 1 file changed, 1 deletion(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index dded571d..6a3df331 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -64,7 +64,6 @@ func! vundle#rc(...) abort let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) let g:updated_bundles = [] let g:vundle_log = [] - let g:vundle_changelog = ['Updated Plugins:'] call vundle#config#init() endf From 088295df77925ee339aacc0e2f2789b0e8f143e8 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 3 Mar 2015 10:50:28 +0100 Subject: [PATCH 09/14] Refactor global variables into script local variables. These variables only occur in one file each. By making them script local variables this is "documented" in the code. At the same time the global namespace is polluted less. Changed: g:bundle_names -> s:bundle_names g:vundle_last_status -> s:last_status g:vundle_log_file -> s:log_file g:vundle_view -> s:view --- autoload/vundle/config.vim | 8 ++++---- autoload/vundle/installer.vim | 6 +++--- autoload/vundle/scripts.vim | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 5ecb30ba..a17eeb12 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -43,7 +43,7 @@ func! vundle#config#init() if !exists('g:bundles') | let g:bundles = [] | endif call s:rtp_rm_a() let g:bundles = [] - let g:bundle_names = {} + let s:bundle_names = {} endf @@ -91,14 +91,14 @@ endf " return -- 0 if the bundle's name has been seen before, 1 otherwise " --------------------------------------------------------------------------- funct! s:check_bundle_name(bundle) - if has_key(g:bundle_names, a:bundle.name) + if has_key(s:bundle_names, a:bundle.name) echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec . - \ '. Plugin ' . g:bundle_names[a:bundle.name] . + \ '. Plugin ' . s:bundle_names[a:bundle.name] . \ ' previously used the name "' . a:bundle.name . '"' . \ '. Skipping Plugin ' . a:bundle.name_spec . '.' return 0 endif - let g:bundle_names[a:bundle.name] = a:bundle.name_spec + let s:bundle_names[a:bundle.name] = a:bundle.name_spec return 1 endf diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 6797d1d4..ffc44bab 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -55,11 +55,11 @@ func! s:process(bang, cmd) exec ':norm '.a:cmd - if 'error' == g:vundle_last_status + if 'error' == s:last_status let msg = 'With errors; press l to view log' endif - if 'updated' == g:vundle_last_status && empty(msg) + if 'updated' == s:last_status && empty(msg) let msg = 'Plugins updated; press u to view changelog' endif @@ -118,7 +118,7 @@ func! vundle#installer#run(func_name, name, ...) abort throw 'whoops, unknown status:'.status endif - let g:vundle_last_status = status + let s:last_status = status return status endf diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f9f23554..4e492fa8 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -54,12 +54,12 @@ endf " View the logfile after an update or installation. " --------------------------------------------------------------------------- func! s:view_log() - if !exists('g:vundle_log_file') - let g:vundle_log_file = tempname() + if !exists('s:log_file') + let s:log_file = tempname() endif - call writefile(g:vundle_log, g:vundle_log_file) - execute 'silent pedit ' . g:vundle_log_file + call writefile(g:vundle_log, s:log_file) + execute 'silent pedit ' . s:log_file wincmd P | wincmd H endf @@ -139,15 +139,15 @@ endf " strings) " --------------------------------------------------------------------------- func! vundle#scripts#view(title, headers, results) - if exists('g:vundle_view') && bufloaded(g:vundle_view) - exec g:vundle_view.'bd!' + if exists('s:view') && bufloaded(s:view) + exec s:view.'bd!' endif exec 'silent pedit [Vundle] '.a:title wincmd P | wincmd H - let g:vundle_view = bufnr('%') + let s:view = bufnr('%') " " make buffer modifiable " to append without errors From 5f27abb9580d0b21933f95e7f741194718b5db1e Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 3 Mar 2015 10:56:24 +0100 Subject: [PATCH 10/14] Allow multiple calls to VundleLog. If it was loaded, unload the log buffer before editing it. Otherwise the editing command can "hang" if the user has `set hidden`. This problem was originally discovered with the VundleChangelog command and the analogous fix was applied in 7d9b10. See github issue #468 for more. --- autoload/vundle/scripts.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 4e492fa8..8f176328 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -58,6 +58,9 @@ func! s:view_log() let s:log_file = tempname() endif + if bufloaded(s:log_file) + execute 'silent bdelete' s:log_file + endif call writefile(g:vundle_log, s:log_file) execute 'silent pedit ' . s:log_file From 356f245fbefa631aa54d2f8a65c05063b278dfe2 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 3 Mar 2015 11:10:16 +0100 Subject: [PATCH 11/14] 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 --- autoload/vundle.vim | 12 ++++++------ autoload/vundle/config.vim | 20 ++++++++++---------- autoload/vundle/installer.vim | 33 +++++++++++++++++---------------- autoload/vundle/scripts.vim | 8 ++++---- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 6a3df331..f186236d 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -21,7 +21,7 @@ com! -nargs=? -bang PluginClean \ call vundle#installer#clean('!' == '') com! -nargs=0 PluginDocs -\ call vundle#installer#helptags(g:bundles) +\ call vundle#installer#helptags(g:vundle#bundles) " Aliases com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! @@ -61,22 +61,22 @@ endif " :Plugin command in the vimrc. It is not possible to do this automatically " because when loading the vimrc file no plugins where loaded yet. func! vundle#rc(...) abort - let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) - let g:updated_bundles = [] - let g:vundle_log = [] + let g:vundle#bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) + let g:vundle#updated_bundles = [] + let g:vundle#log = [] call vundle#config#init() endf " Alternative to vundle#rc, offers speed up by modifying rtp only when end() " called later. func! vundle#begin(...) abort - let g:vundle_lazy_load = 1 + let g:vundle#lazy_load = 1 call call('vundle#rc', a:000) endf " Finishes putting plugins on the rtp. func! vundle#end(...) abort - unlet g:vundle_lazy_load + unlet g:vundle#lazy_load call vundle#config#activate_bundles() endf diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index a17eeb12..8467b9f7 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -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 diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index ffc44bab..472271a3 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -1,6 +1,7 @@ " --------------------------------------------------------------------------- -" Try to clone all new bundles given (or all bundles in g:bundles by default) -" to g:bundle_dir. If a:bang is 1 it will also update all plugins (git pull). +" Try to clone all new bundles given (or all bundles in g:vundle#bundles by +" default) to g:vundle#bundle_dir. If a:bang is 1 it will also update all +" plugins (git pull). " " bang -- 1 or 0 " ... -- any number of bundle specifications (separate arguments) @@ -8,10 +9,10 @@ func! vundle#installer#new(bang, ...) abort " No specific plugins are specified. Operate on all plugins. if a:0 == 0 - let bundles = g:bundles + let bundles = g:vundle#bundles " Specific plugins are specified for update. Update them. elseif (a:bang) - let bundles = filter(copy(g:bundles), 'index(a:000, v:val.name) > -1') + let bundles = filter(copy(g:vundle#bundles), 'index(a:000, v:val.name) > -1') " Specific plugins are specified for installation. Install them. else let bundles = map(copy(a:000), 'vundle#config#bundle(v:val, {})') @@ -23,7 +24,7 @@ func! vundle#installer#new(bang, ...) abort endif 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 plugins to '.expand(g:vundle#bundle_dir, 1)], names + ['Helptags']) " This calls 'add' as a normal mode command. This is a buffer local mapping " defined in vundle#scripts#view(). The mapping will call a buffer local @@ -163,10 +164,10 @@ endf " return -- the return value from s:sync() " --------------------------------------------------------------------------- func! vundle#installer#install(bang, name) abort - if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif + if !isdirectory(g:vundle#bundle_dir) | call mkdir(g:vundle#bundle_dir, 'p') | endif let n = substitute(a:name,"['".'"]\+','','g') - let matched = filter(copy(g:bundles), 'v:val.name_spec == n') + let matched = filter(copy(g:vundle#bundles), 'v:val.name_spec == n') if len(matched) > 0 let b = matched[0] @@ -179,12 +180,12 @@ endf " --------------------------------------------------------------------------- -" Call :helptags for all bundles in g:bundles. +" Call :helptags for all bundles in g:vundle#bundles. " " return -- 'error' if an error occurred, else return 'helptags' " --------------------------------------------------------------------------- func! vundle#installer#docs() abort - let error_count = vundle#installer#helptags(g:bundles) + let error_count = vundle#installer#helptags(g:vundle#bundles) if error_count > 0 return 'error' endif @@ -222,10 +223,10 @@ endf " bang -- not used " --------------------------------------------------------------------------- func! vundle#installer#list(bang) abort - let bundles = vundle#scripts#bundle_names(map(copy(g:bundles), 'v:val.name_spec')) + let bundles = vundle#scripts#bundle_names(map(copy(g:vundle#bundles), 'v:val.name_spec')) call vundle#scripts#view('list', ['" My Plugins'], bundles) redraw - echo len(g:bundles).' plugins configured' + echo len(g:vundle#bundles).' plugins configured' endf @@ -237,10 +238,10 @@ endf " should be removed unconditionally " --------------------------------------------------------------------------- func! vundle#installer#clean(bang) abort - let bundle_dirs = map(copy(g:bundles), 'v:val.path()') + let bundle_dirs = map(copy(g:vundle#bundles), 'v:val.path()') let all_dirs = (v:version > 702 || (v:version == 702 && has("patch51"))) - \ ? split(globpath(g:bundle_dir, '*', 1), "\n") - \ : split(globpath(g:bundle_dir, '*'), "\n") + \ ? split(globpath(g:vundle#bundle_dir, '*', 1), "\n") + \ : split(globpath(g:vundle#bundle_dir, '*'), "\n") let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') if empty(x_dirs) @@ -465,7 +466,7 @@ func! s:sync(bang, bundle) abort return 'todate' endif - call add(g:updated_bundles, [initial_sha, updated_sha, a:bundle]) + call add(g:vundle#updated_bundles, [initial_sha, updated_sha, a:bundle]) return 'updated' endf @@ -527,7 +528,7 @@ func! s:log(str, ...) abort let lines = split(a:str, '\n', 1) let time = strftime(fmt) for line in lines - call add(g:vundle_log, '['. time .'] '. prefix . line) + call add(g:vundle#log, '['. time .'] '. prefix . line) endfor return a:str endf diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 8f176328..5d564760 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -42,7 +42,7 @@ endf func! vundle#scripts#complete(a,c,d) if match(a:c, '\v^%(Plugin|Vundle)%(Install!|Update)') == 0 " Only installed plugins if updating - return join(map(copy(g:bundles), 'v:val.name'), "\n") + return join(map(copy(g:vundle#bundles), 'v:val.name'), "\n") else " Or all known plugins otherwise return join(s:load_scripts(0),"\n") @@ -61,7 +61,7 @@ func! s:view_log() if bufloaded(s:log_file) execute 'silent bdelete' s:log_file endif - call writefile(g:vundle_log, s:log_file) + call writefile(g:vundle#log, s:log_file) execute 'silent pedit ' . s:log_file wincmd P | wincmd H @@ -74,7 +74,7 @@ endf " --------------------------------------------------------------------------- func! s:create_changelog() abort let changelog = ['Updated Plugins:'] - for bundle_data in g:updated_bundles + for bundle_data in g:vundle#updated_bundles let initial_sha = bundle_data[0] let updated_sha = bundle_data[1] let bundle = bundle_data[2] @@ -258,7 +258,7 @@ endf " specifications) of all plugins from vim-scripts.org " --------------------------------------------------------------------------- func! s:load_scripts(bang) - let f = expand(g:bundle_dir.'/.vundle/script-names.vim-scripts.org.json', 1) + let f = expand(g:vundle#bundle_dir.'/.vundle/script-names.vim-scripts.org.json', 1) if a:bang || !filereadable(f) if 0 != s:fetch_scripts(f) return [] From 16237bbb73f1f03b494d3ade77fd0ab947776dfb Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Tue, 3 Mar 2015 11:20:43 +0100 Subject: [PATCH 12/14] Set default values for autoload variables. The setting of the default values for the autoload variables is moved out of any function. One reason being that these settings do not depend on the argument of the function. The second being that Vim will source the autoload script if an undefined autoload variable is referenced and the file is expected to define the variable (see :help autoload). --- autoload/vundle.vim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index f186236d..e458618e 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -61,9 +61,9 @@ endif " :Plugin command in the vimrc. It is not possible to do this automatically " because when loading the vimrc file no plugins where loaded yet. func! vundle#rc(...) abort - let g:vundle#bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1) - let g:vundle#updated_bundles = [] - let g:vundle#log = [] + if a:0 > 0 + let g:vundle#bundle_dir = expand(a:1, 1) + endif call vundle#config#init() endf @@ -80,4 +80,11 @@ func! vundle#end(...) abort call vundle#config#activate_bundles() endf +" Initialize some global variables used by Vundle. +let vundle#bundle_dir = expand('$HOME/.vim/bundle', 1) +let vundle#bundles = [] +let vundle#lazy_load = 0 +let vundle#log = [] +let vundle#updated_bundles = [] + " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: From 2506347586621114ccb6fedb7f93a560fc19c691 Mon Sep 17 00:00:00 2001 From: Shahaf Arad Date: Fri, 13 Mar 2015 20:00:47 +0200 Subject: [PATCH 13/14] Prevent insecure plugin names. Plugins' names which contain '../', '$HOME', '%:h:h', '..\', etc. can be dangerous. Use a sensible whitelist for plugin names and prevent its expansion. --- autoload/vundle/config.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 8467b9f7..0e02b112 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -97,6 +97,9 @@ funct! s:check_bundle_name(bundle) \ ' previously used the name "' . a:bundle.name . '"' . \ '. Skipping Plugin ' . a:bundle.name_spec . '.' return 0 + elseif a:bundle.name !~ '\v^[A-Za-z0-9_-]%(\.?[A-Za-z0-9_-])*$' + echoerr 'Invalid plugin name: ' . a:bundle.name + return 0 endif let s:bundle_names[a:bundle.name] = a:bundle.name_spec return 1 @@ -262,7 +265,7 @@ let s:bundle = {} " return -- the target location to clone this bundle to " --------------------------------------------------------------------------- func! s:bundle.path() - return s:expand_path(g:vundle#bundle_dir.'/'.self.name) + return s:expand_path(g:vundle#bundle_dir.'/') . self.name endf From 8b670ee9141bb1a44940bbac975bc173a190a7b6 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Mon, 28 Apr 2014 16:30:37 +0200 Subject: [PATCH 14/14] add command to explore bundle dir --- autoload/vundle.vim | 5 ++++- autoload/vundle/scripts.vim | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index e458618e..e0472ef7 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -23,6 +23,9 @@ com! -nargs=? -bang PluginClean com! -nargs=0 PluginDocs \ call vundle#installer#helptags(g:vundle#bundles) +com! -nargs=? -complete=custom,vundle#scripts#complete PluginExplore +\ call vundle#scripts#explore() + " Aliases com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! @@ -31,8 +34,8 @@ com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall Plugi com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleSearch PluginSearch com! -nargs=? -bang VundleClean PluginClean com! -nargs=0 VundleDocs PluginDocs -com! VundleUpdate PluginInstall! com! -nargs=* -complete=custom,vundle#scripts#complete VundleUpdate PluginInstall! +com! -nargs=? -complete=custom,vundle#scripts#complete VundleExplore PluginExplore " Deprecated Commands com! -nargs=+ Bundle call vundle#config#bundle() diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index 5d564760..3b5b0efd 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -212,6 +212,22 @@ func! vundle#scripts#view(title, headers, results) endf +" --------------------------------------------------------------------------- +" Explore the folder of a given bundle or g:bundle_dir. +" +" bundle -- either a bundle object or a bundle specification string. +" --------------------------------------------------------------------------- +func! vundle#scripts#explore(bundle) + if empty(a:bundle) + exec 'Vexplore' g:bundle_dir + elseif type(a:bundle) == type({}) + exec 'Vexplore' a:bundle.rtpath + elseif type(a:bundle) == type('') + exec 'Vexplore' vundle#config#init_bundle(a:bundle, {}).rtpath + endif +endf + + " --------------------------------------------------------------------------- " Load the plugin database from vim-scripts.org . "