Skip to content

Commit 1df432a

Browse files
Shahaf Aradjdevera
authored andcommitted
Allow updating specific plugins.
1 parent a864467 commit 1df432a

4 files changed

Lines changed: 40 additions & 9 deletions

File tree

autoload/vundle.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
com! -nargs=+ -bar Plugin
99
\ call vundle#config#bundle(<args>)
1010

11-
com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginInstall
12-
\ call vundle#installer#new('!' == '<bang>', <q-args>)
11+
com! -nargs=* -bang -complete=custom,vundle#scripts#complete PluginInstall
12+
\ call vundle#installer#new('!' == '<bang>', <f-args>)
1313

1414
com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginSearch
1515
\ call vundle#scripts#all('!' == '<bang>', <q-args>)
@@ -24,7 +24,7 @@ com! -nargs=0 PluginDocs
2424
\ call vundle#installer#helptags(g:bundles)
2525

2626
" Aliases
27-
com! PluginUpdate PluginInstall!
27+
com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! <args>
2828

2929
" Vundle Aliases
3030
com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall PluginInstall<bang> <args>

autoload/vundle/installer.vim

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,21 @@
66
" ... -- any number of bundle specifications (separate arguments)
77
" ---------------------------------------------------------------------------
88
func! vundle#installer#new(bang, ...) abort
9-
let bundles = (a:1 == '') ?
10-
\ g:bundles :
11-
\ map(copy(a:000), 'vundle#config#bundle(v:val, {})')
9+
" No specific plugins are specified. Operate on all plugins.
10+
if a:0 == 0
11+
let bundles = g:bundles
12+
" Specific plugins are specified for update. Update them.
13+
elseif (a:bang)
14+
let bundles = filter(copy(g:bundles), 'index(a:000, v:val.name) > -1')
15+
" Specific plugins are specified for installation. Install them.
16+
else
17+
let bundles = map(copy(a:000), 'vundle#config#bundle(v:val, {})')
18+
endif
19+
20+
if empty(bundles)
21+
echoerr 'No bundles were selected for operation'
22+
return
23+
endif
1224

1325
let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec'))
1426
call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:bundle_dir, 1)], names + ['Helptags'])

autoload/vundle/scripts.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ endf
3939
" candidates, see also :h command-completion-custom
4040
" ---------------------------------------------------------------------------
4141
func! vundle#scripts#complete(a,c,d)
42-
return join(s:load_scripts(0),"\n")
42+
" Return only installed plugins if updating
43+
if match(a:c, '\v^Plugin%(Install!|Update)') == 0
44+
return join(map(copy(g:bundles), 'v:val.name'), "\n")
45+
else
46+
return join(s:load_scripts(0),"\n")
47+
endif
4348
endf
4449

4550

doc/vundle.txt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,16 @@ PluginInstall allows installation of plugins by name:
244244
>
245245
:PluginInstall unite.vim
246246
247-
Installs and activates unite.vim. You can use Tab to auto-complete known
248-
script names. Note that the installation just described isn't permanent. To
247+
Installs and activates unite.vim.
248+
249+
PluginInstall also allows installation of several plugins separated by space.
250+
>
251+
:PluginInstall tpope/vim-surround tpope/vim-fugitive
252+
253+
Installs both tpope/vim-surround and tpope/vim-fugitive from GitHub.
254+
255+
You can use Tab to auto-complete known script names.
256+
Note that the installation just described isn't permanent. To
249257
finish, you must put `Plugin 'unite.vim'` at the appropriate place in your
250258
`.vimrc` to tell Vundle to load the plugin at startup.
251259

@@ -263,6 +271,12 @@ Installs or updates the configured plugins. Press 'u' after updates complete
263271
to see the change log of all updated bundles. Press 'l' (lowercase 'L') to
264272
see the log of commands if any errors occurred.
265273

274+
To update specific plugins, write their names separated by space:
275+
>
276+
:PluginInstall! vim-surround vim-fugitive
277+
or >
278+
:PluginUpdate vim-surround vim-fugitive
279+
266280
3.5 SEARCHING PLUGINS ~
267281
*vundle-plugins-search* *:PluginSearch*
268282
>

0 commit comments

Comments
 (0)