Permalink
Browse files

Braid: Add mirror 'vundle' at '75e11ff'

  • Loading branch information...
kergoth committed Mar 1, 2011
1 parent 4ebb037 commit 88254e0d66f2b45b157d643eab243082871fdb45
View
@@ -0,0 +1,8 @@
+---
+vundle:
+ branch: master
+ remote: braid/vundle
+ revision: 75e11ff51e41180eb00faf66277a490e5d83fbbb
+ squashed: true
+ type: git
+ url: https://github.com/gmarik/vundle.git
View
@@ -0,0 +1,87 @@
+## About
+
+[Vundle] is a short cut for **V**imb**undle** and is a [Vim] plugin manager.
+
+## Quick start
+
+1. Setup [Vundle]:
+
+ git clone http://github.com/gmarik/vundle.git ~/.vim/vundle.git
+
+2. Configure bundles:
+
+ Append to your `~/.vimrc`:
+
+ set rtp+=~/.vim/vundle.git/
+ call vundle#rc()
+
+ " Bundles:
+ Bundle "L9"
+ Bundle "FuzzyFinder"
+ Bundle "rails.vim"
+ Bundle "ack.vim"
+ Bundle "git://git.wincent.com/command-t.git"
+ " ...
+
+3. Install configured bundles:
+
+ Launch `vim`, run `:BundleInstall` (**no `Vim` restart required** since v0.5)
+
+ Installing requires [Git] and triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo to `~/.vim/bundle/`.
+
+## Why Vundle
+
+[Vundle] allows to:
+
+- keep track and configure your scripts right in `.vimrc`
+- install configured scripts (aka bundle)
+- update configured scripts
+- search [all available vim scripts] by name
+- clean unused scripts up
+
+Also as a bonus [Vundle]:
+
+- manages runtime path of your installed scripts
+- regenerates helptag atomatically
+
+
+## Docs
+
+see [`:h vundle`](vundle/blob/master/doc/vundle.txt) vimdoc for more details.
+
+## Examples
+
+ See [gmarik's vimrc](https://github.com/gmarik/vimfiles/blob/1f4f26d42f54443f1158e0009746a56b9a28b053/vimrc#L136) for working example.
+
+## Inspiration and ideas from
+
+* [pathogen]
+* [bundler]
+* [Scott Bronson](http://github.com/bronson)
+
+## Also
+
+* Vundle was developed and tested in [Vim] 7.3 on `OSX` and `Linux`
+* Vundle wasn't tested on windows(so if you care i'm waiting for your pull request)
+* Vundle tries to be as [KISS](http://en.wikipedia.org/wiki/KISS_principle) as possible
+
+## TODO:
+[Vundle] is a work in progress so any ideas/patches appreciated
+
+* √ activate newly added bundles on .vimrc reload or after :BundleInstall
+* √ use preview window for search results
+* √ vim documentation
+* improve error handling
+* allow specify revision/version?
+* search by description aswell
+* show descrption in search results
+* instead sourcing .vimrc before installation come up with another solution
+* tests
+* make it rock!
+
+[Vundle]:http://github.com/gmarik/vundle
+[Pathogen]:http://github.com/tpope/vim-pathogen/
+[Bundler]:http://github.com/wycats/bundler/
+[Vim]:http://vim.org
+[Git]:http://git-scm.com
+[all available vim scripts]:http://vim-scripts.org/vim/scripts.html
View
@@ -0,0 +1,19 @@
+" Vundle is a shortcut for Vim Bundle and Is a simple plugin manager for Vim
+" Author: gmarik
+" HomePage: http://github.com/gmarik/vundle
+" Readme: http://github.com/gmarik/vundle/blob/master/README.md
+" Version: 0.5
+
+com! -nargs=+ Bundle call vundle#config#bundle(<args>)
+com! -nargs=? -bang BundleInstall call vundle#installer#install('<bang>')
+com! -nargs=? -bang BundleClean call vundle#installer#clean('<bang>')
+com! -nargs=0 BundleDocs call vundle#installer#helptags()
+
+com! -nargs=+ -bang BundleSearch silent call vundle#scripts#search('<bang>', <q-args>)
+
+com! -nargs=0 VundleLog silent pedit `=g:vundle_log`
+
+func! vundle#rc()
+ let g:bundle_dir = expand('$HOME/.vim/bundle')
+ call vundle#config#init()
+endf
@@ -0,0 +1,75 @@
+func! vundle#config#bundle(arg, ...)
+ let bundle = extend(s:parse_options(a:000), s:parse_name(a:arg))
+ call extend(bundle, copy(s:bundle))
+ call s:rtp_rm_a()
+ call add(g:bundles, bundle)
+ call s:rtp_add_a()
+ " TODO: fix this: explicit sourcing kills command-T
+ " call vundle#config#require(bundle)
+endf
+
+func! vundle#config#init()
+ if !exists('g:bundles') | let g:bundles = [] | endif
+ let g:vundle_log = tempname()
+ call s:rtp_rm_a()
+ let g:bundles = []
+endf
+
+func! vundle#config#require(bundle)
+ call s:rtp_add(g:bundle_dir)
+ " TODO: it has to be relative rtpath, not bundle.name
+ exec 'runtime! '.a:bundle.name.'/plugin/*.vim'
+ exec 'runtime! '.a:bundle.name.'/after/*.vim'
+ call s:rtp_rm(g:bundle_dir)
+endf
+
+func! s:parse_options(opts)
+ " TODO: improve this
+ if len(a:opts) != 1 | return {} | endif
+
+ if type(a:opts[0]) == type({})
+ return a:opts[0]
+ else
+ return {'rev': a:opts[0]}
+ endif
+endf
+
+func! s:parse_name(arg)
+ let arg = a:arg
+ if arg =~ '^\s*\(git@\|git://\)\S\+' || arg =~ 'https\?://' || arg =~ '\.git\s*$'
+ let uri = arg
+ let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i')
+ else
+ let name = arg
+ let uri = 'http://github.com/vim-scripts/'.name.'.git'
+ endif
+ return {'name': name, 'uri': uri }
+endf
+
+func! s:rtp_rm_a()
+ for b in g:bundles | call s:rtp_rm(b.rtpath()) | endfor
+endf
+
+func! s:rtp_add_a()
+ for b in reverse(copy(g:bundles)) | call s:rtp_add(b.rtpath()) | endfor
+endf
+
+func! s:rtp_rm(dir)
+ exec 'set rtp-='.a:dir
+ exec 'set rtp-='.expand(a:dir.'/after')
+endf
+
+func! s:rtp_add(dir)
+ exec 'set rtp^='.a:dir
+ exec 'set rtp+='.expand(a:dir.'/after')
+endf
+
+let s:bundle = {}
+
+func! s:bundle.path()
+ return join([g:bundle_dir, self.name], '/')
+endf
+
+func! s:bundle.rtpath()
+ return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path()
+endf
@@ -0,0 +1,66 @@
+func! vundle#installer#install(bang)
+ call s:reload_bundles()
+ if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
+ for bundle in g:bundles | call s:install('!' == a:bang, bundle) | endfor
+endf
+
+func! vundle#installer#helptags()
+ let c = 0
+ for bundle in g:bundles | let c += s:helptags(bundle.rtpath()) | endfor
+ call s:log('Done. '.c.' bundles processed')
+endf
+
+func! vundle#installer#clean(bang)
+ let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
+ let all_dirs = split(globpath(g:bundle_dir, '*'), "\n")
+ let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')
+ if (!empty(x_dirs))
+ if ('!' == a:bang || input('Are you sure you want to remove '.len(x_dirs).' bundles?') =~? 'y')
+ exec '!rm -rf '.join(map(x_dirs, 'shellescape(v:val)'), ' ')
+ endif
+ end
+endf
+
+func! s:reload_bundles()
+ " TODO: obtain Bundles without sourcing .vimrc
+ silent source $MYVIMRC
+ if filereadable($MYGVIMRC)| silent source $MYGVIMRC | endif
+endf
+
+func! s:helptags(rtp)
+ if !(isdirectory(a:rtp.'/doc') && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags')))
+ return 0
+ endif
+ helptags `=a:rtp.'/doc'`
+ return 1
+endf
+
+func! s:sync(bang, bundle)
+ let git_dir = a:bundle.path().'/.git'
+ silent exec '!echo "* '.a:bundle.name.'" 2>&1 >>'. g:vundle_log
+ if isdirectory(git_dir)
+ if !(a:bang) | return 0 | endif
+ silent exec '!cd '.a:bundle.path().'; git pull 2>&1 >>'.g:vundle_log
+ else
+ silent exec '!git clone '.a:bundle.uri.' '.a:bundle.path().' 2>&1 >>'.g:vundle_log
+ endif
+ return 1
+endf
+
+func! s:install(bang, bundle)
+ let synced = s:sync(a:bang, a:bundle)
+ call s:helptags(a:bundle.rtpath())
+ call s:log(a:bundle.name.' '.(synced ? '': ' already').' installed')
+ if synced | call vundle#config#require(a:bundle) | endif
+endf
+
+" TODO: make it pause after output in console mode
+func! s:log(msg)
+ if has('gui_running')
+ echo a:msg
+ else
+ " console vim requires to hit ENTER after each !cmd with stdout output
+ " workaround
+ silent exec '! echo '.a:msg.' >&2| cat >/dev/null'
+ endif
+endf
@@ -0,0 +1,29 @@
+func! vundle#scripts#search(bang,search_str)
+ let matches = filter(s:load_scripts(a:bang), 'v:val =~? "'.escape(a:search_str,'"').'"')
+ let results = map(matches, ' printf("Bundle ' ."'%s'".'", v:val) ')
+ call s:display(reverse(results), a:search_str)
+endf
+
+func! s:display(results,search_str)
+ if !exists('s:buff') | let s:buff = tempname() | endif
+ call writefile(['" Search results for: '.a:search_str] + a:results, s:buff)
+ pedit `=s:buff`
+ wincmd P
+ let @/=a:search_str
+ setlocal hls ignorecase ft=vim
+ redraw!
+endf
+
+func! s:fetch_scripts(to)
+ let temp = tempname()
+ exec '!curl http://vim-scripts.org/api/scripts.json > '.temp
+ exec '!mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to
+endf
+
+func! s:load_scripts(bang)
+ let f = expand('$HOME/.vim-vundle/vim-scripts.org.json')
+ if '!' == a:bang || !filereadable(f)
+ call s:fetch_scripts(f)
+ endif
+ return eval(readfile(f, 'b')[0])
+endf
Oops, something went wrong.

0 comments on commit 88254e0

Please sign in to comment.