Skip to content

Commit

Permalink
use Plugin instead Bundle
Browse files Browse the repository at this point in the history
- closes many issues )
  • Loading branch information
gmarik authored and starcraftman committed Mar 23, 2014
1 parent 9411586 commit 0521de9
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 156 deletions.
66 changes: 35 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@

[Vundle] allows you to...

* keep track of and configure your scripts right in the `.vimrc`
* [install] configured scripts (a.k.a. bundle)
* [update] configured scripts
* keep track of and [configure] your plugins right in the `.vimrc`
* [install] configured plugins (a.k.a. scripts/bundle)
* [update] configured plugins
* [search] by name all available [Vim scripts]
* [clean] unused scripts up
* [clean] unused plugins up
* run the above actions in a *single keypress* with [interactive mode]

[Vundle] automatically...

* manages the [runtime path] of your installed scripts
* regenerates [help tags] after installing and updating

[Vundle] is undergoing an [interface change], please stay up to date to get latest changes.

![Vundle-installer](http://25.media.tumblr.com/tumblr_m8m96w06G81r39828o1_1280.png)

## Quick Start
Expand All @@ -33,9 +35,9 @@

`$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle`

3. Configure Bundles:
3. Configure Plugins:

Put this at the top of your `.vimrc` to use Vundle. Remove bundles you don't need, they are for illustration purposes.
Put this at the top of your `.vimrc` to use Vundle. Remove plugins you don't need, they are for illustration purposes.

```vim
set nocompatible " be iMproved, required
Expand All @@ -44,51 +46,51 @@
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" alternatively, pass a path where Vundle should install bundles
" alternatively, pass a path where Vundle should install plugins
"let path = '~/some/path/here'
"call vundle#rc(path)
" let Vundle manage Vundle, required
Bundle 'gmarik/vundle'
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep bundle commands between here and filetype plugin indent on.
" Keep Plugin commands between here and filetype plugin indent on.
" scripts on GitHub repos
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'tpope/vim-rails.git'
Plugin 'tpope/vim-fugitive'
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.
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" scripts from http://vim-scripts.org/vim/scripts.html
Bundle 'L9'
Bundle 'FuzzyFinder'
Plugin 'L9'
Plugin 'FuzzyFinder'
" scripts not on GitHub
Bundle 'git://git.wincent.com/command-t.git'
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Bundle 'file:///home/gmarik/path/to/plugin'
Plugin 'file:///home/gmarik/path/to/plugin'
" ...
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install (update) bundles
" :BundleSearch(!) foo - search (or refresh cache first) for foo
" :BundleClean(!) - confirm (or auto-approve) removal of unused bundles
" :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
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle commands are not allowed.
" NOTE: comments after Plugin commands are not allowed.
" Put your stuff after this line
```

4. Install Bundles:
4. Install Plugins:

Launch `vim` and run `:BundleInstall`
Launch `vim` and run `:PluginInstall`

To install from command line: `vim +BundleInstall +qall`
To install from command line: `vim +PluginInstall +qall`

## Docs

Expand Down Expand Up @@ -118,7 +120,7 @@ see [Vundle contributors](https://github.com/gmarik/vundle/graphs/contributors)
## TODO:
[Vundle] is a work in progress, so any ideas and patches are appreciated.

* ✓ activate newly added bundles on `.vimrc` reload or after `:BundleInstall`
* ✓ activate newly added bundles on `.vimrc` reload or after `:PluginInstall`
* ✓ use preview window for search results
* ✓ Vim documentation
* ✓ put Vundle in `bundles/` too (will fix Vundle help)
Expand All @@ -141,8 +143,10 @@ see [Vundle contributors](https://github.com/gmarik/vundle/graphs/contributors)
[help tags]:http://vimdoc.sourceforge.net/htmldoc/helphelp.html#:helptags
[runtime path]:http://vimdoc.sourceforge.net/htmldoc/options.html#%27runtimepath%27

[install]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L179-198
[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L200-209
[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L211-238
[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L247-260
[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L263-303
[configure]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L122-L205
[install]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L207-L226
[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L228-L237
[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L239-L267
[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L276-L289
[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L292-L331
[interface change]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L345-L369
44 changes: 43 additions & 1 deletion autoload/vundle.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@
" Readme: http://github.com/gmarik/vundle/blob/master/README.md
" Version: 0.9

" Plugin Commands
com! -nargs=+ -bar Plugin
\ call vundle#config#bundle(<args>)

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

com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginSearch
\ call vundle#scripts#all('!'=='<bang>', <q-args>)

com! -nargs=? -bang -complete=custom,vundle#scripts#complete Plugins
\ call vundle#scripts#all('!'=='<bang>', <q-args>)

com! -nargs=0 -bang PluginList
\ call vundle#installer#list('!'=='<bang>')

com! -nargs=? -bang PluginClean
\ call vundle#installer#clean('!' == '<bang>')

com! -nargs=0 PluginDocs
\ call vundle#installer#helptags(g:bundles)

" Aliases
com! PluginUpdate PluginInstall!

" Vundle Aliases
com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall
\ call vundle#installer#new('!' == '<bang>', <q-args>)

com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleSearch
\ call vundle#scripts#all('!'=='<bang>', <q-args>)

com! -nargs=? -bang VundleClean
\ call vundle#installer#clean('!' == '<bang>')

com! -nargs=0 VundleDocs
\ call vundle#installer#helptags(g:bundles)

" Aliases
com! VundleUpdate PluginInstall!

" deprecated
com! -nargs=+ Bundle
\ call vundle#config#bundle(<args>)

Expand All @@ -22,7 +64,7 @@ com! -nargs=0 -bang BundleList
com! -nargs=? -bang BundleClean
\ call vundle#installer#clean('!' == '<bang>')

com! -nargs=0 BundleDocs
com! -nargs=0 BundleDocs
\ call vundle#installer#helptags(g:bundles)

" Aliases
Expand Down
6 changes: 3 additions & 3 deletions autoload/vundle/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ endf

func! vundle#config#init_bundle(name, opts)
if a:name != substitute(a:name, '^\s*\(.\{-}\)\s*$', '\1', '')
echo "Spurious leading and/or trailing whitespace found in bundle spec '" . a:name . "'"
echo "Spurious leading and/or trailing whitespace found in plugin spec '" . a:name . "'"
endif
let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')))
let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')), 'keep')
let b = extend(opts, copy(s:bundle))
let b.rtpath = s:rtpath(opts)
return b
Expand Down Expand Up @@ -55,7 +55,7 @@ func! s:parse_name(arg)
let uri .= '.git'
endif
let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i')
elseif arg =~? '^\s*\(git@\|git://\)\S\+'
elseif arg =~? '^\s*\(git@\|git://\)\S\+'
\ || arg =~? '\(file\|https\?\)://'
\ || arg =~? '\.git\s*$'
let uri = arg
Expand Down
29 changes: 18 additions & 11 deletions autoload/vundle/installer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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'))

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -100,7 +100,14 @@ endf
func! vundle#installer#install(bang, name) abort
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif

let b = vundle#config#init_bundle(a:name, {})
let n = substitute(a:name,"['".'"]\+','','g')
let matched = filter(copy(g:bundles), 'v:val.name_spec == n')

if len(matched) > 0
let b = matched[0]
else
let b = vundle#config#init_bundle(a:name, {})
endif

return s:sync(a:bang, b)
endf
Expand All @@ -123,21 +130,21 @@ func! vundle#installer#helptags(bundles) abort
let statuses = map(copy(help_dirs), 's:helptags(v:val)')
let errors = filter(statuses, 'v:val == 0')

call s:log('Helptags: '.len(help_dirs).' bundles processed')
call s:log('Helptags: '.len(help_dirs).' plugins processed')

return len(errors)
endf

func! vundle#installer#list(bang) abort
let bundles = vundle#scripts#bundle_names(map(copy(g:bundles), 'v:val.name_spec'))
call vundle#scripts#view('list', ['" My Bundles'], bundles)
call vundle#scripts#view('list', ['" My Plugins'], bundles)
redraw
echo len(g:bundles).' bundles configured'
echo len(g:bundles).' plugins configured'
endf


func! vundle#installer#clean(bang) abort
let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
let bundle_dirs = map(copy(g: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")
Expand All @@ -147,7 +154,7 @@ func! vundle#installer#clean(bang) abort
let headers = ['" All clean!']
let names = []
else
let headers = ['" Removing bundles:']
let headers = ['" Removing Plugins:']
let names = vundle#scripts#bundle_names(map(copy(x_dirs), 'fnamemodify(v:val, ":t")'))
end

Expand Down Expand Up @@ -179,7 +186,7 @@ func! vundle#installer#delete(bang, dir_name) abort
let out = s:system(cmd)

call s:log('')
call s:log('Bundle '.a:dir_name)
call s:log('Plugin '.a:dir_name)
call s:log('$ '.cmd)
call s:log('> '.out)

Expand Down Expand Up @@ -229,7 +236,7 @@ func! s:sync(bang, bundle) abort

let out = s:system(cmd)
call s:log('')
call s:log('Bundle '.a:bundle.name_spec)
call s:log('Plugin '.a:bundle.name_spec)
call s:log('$ '.cmd)
call s:log('> '.out)

Expand Down
Loading

0 comments on commit 0521de9

Please sign in to comment.