Browse Source

Pull from upstream gmarik/vundle and merge conflicts.

pull/116/head
Marwan Al Jubeh 13 years ago
parent
commit
0c98fa21f7
10 changed files with 216 additions and 76 deletions
  1. +1
    -0
      .gitignore
  2. +7
    -0
      LICENSE-MIT.txt
  3. +18
    -25
      README.md
  4. +7
    -1
      autoload/vundle.vim
  5. +22
    -9
      autoload/vundle/config.vim
  6. +72
    -25
      autoload/vundle/installer.vim
  7. +46
    -3
      autoload/vundle/scripts.vim
  8. +15
    -4
      doc/vundle.txt
  9. +20
    -0
      test/files/test.erl
  10. +8
    -9
      test/vimrc

+ 1
- 0
.gitignore View File

@ -0,0 +1 @@
doc/tags

+ 7
- 0
LICENSE-MIT.txt View File

@ -0,0 +1,7 @@
Copyright (C) 2010 http://github.com/gmarik
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 18
- 25
README.md View File

@ -1,15 +1,15 @@
## About
[Vundle] is short for **V**imb**undle** and is a [Vim] plugin manager.
[Vundle] is short for _Vim bundle_ and is a [Vim] plugin manager.
![Vundle-installer](https://lh3.googleusercontent.com/-4EnLqLpEZlk/TlqXWpgWxOI/AAAAAAAAHRw/oBAl6s1hj7U/vundle-install2.png)
![Vundle-installer](http://25.media.tumblr.com/tumblr_m8m96w06G81r39828o1_1280.png)
## Quick start
1. Setup [Vundle]:
```
$ git clone http://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
```
2. Configure bundles:
@ -33,15 +33,15 @@
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
Bundle 'rails.vim'
" non github repos
Bundle 'git://git.wincent.com/command-t.git'
" ...
filetype plugin indent on " required!
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
@ -56,15 +56,16 @@
3. Install configured bundles:
Launch `vim`, run `:BundleInstall`.
Launch `vim`, run `:BundleInstall`
(or `vim +BundleInstall +qall` for CLI lovers)
*Windows users* see [Vundle for Windows](https://github.com/gmarik/vundle/wiki/Vundle-for-Windows)
Installing requires [Git] and triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo to `~/.vim/bundle/`.
4. Consider [donating](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T44EJZX8RBUWY)
*Thank you* for supporting this project! )
[*Thank you*](http://j.mp/rSbm01) for supporting this project! )
## Why Vundle
@ -81,7 +82,7 @@
Also [Vundle]:
- manages runtime path of your installed scripts
- regenerates helptag atomatically
- regenerates helptag automatically
## Docs
@ -89,23 +90,15 @@ see [`:h vundle`](vundle/blob/master/doc/vundle.txt#L1) vimdoc for more details.
## People Using Vundle
* [gmarik's vimrc](https://github.com/gmarik/vimfiles/blob/1f4f26d42f54443f1158e0009746a56b9a28b053/vimrc#L136)
* [mutewinter's Vim Config of Champions](https://github.com/mutewinter/dot_vim)
If you have an interesting example, feel free to send a pull request with link to your config. Thx!
see [Examples](https://github.com/gmarik/vundle/wiki/Examples)
## FAQ
see [wiki](/gmarik/vundle/wiki)
see [wiki](https://github.com/gmarik/vundle/wiki)
## Contributors
* [redlinesoftware](http://redlinesoftware.com) - for lending me 24" monitor!
* [Marc Jeanson](https://github.com/marcjeanson) - vim dude I always bug for help...;)
* [Brad Anderson](http://github.com/eco) (windows support)
* [Ryan W](http://github.com/rygwdn)
* [termac](http://github.com/termac)
* and others
see [vundle contributors](https://github.com/gmarik/vundle/graphs/contributors)
*Thank you!*
@ -138,12 +131,12 @@ see [wiki](/gmarik/vundle/wiki)
[Vundle]:http://github.com/gmarik/vundle
[Pathogen]:http://github.com/tpope/vim-pathogen/
[Bundler]:http://github.com/wycats/bundler/
[Vim]:http://vim.org
[Vim]:http://www.vim.org
[Git]:http://git-scm.com
[all available vim scripts]:http://vim-scripts.org/vim/scripts.html
[install]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L110-124
[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L128-133
[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L135-157
[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L167-179
[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L183-209
[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L128-134
[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L136-158
[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L168-180
[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L184-210

+ 7
- 1
autoload/vundle.vim View File

@ -25,18 +25,24 @@ com! -nargs=? -bang BundleClean
com! -nargs=0 BundleDocs
\ call vundle#installer#helptags(g:bundles)
" Aliases
com! BundleUpdate BundleInstall!
if (has('signs'))
sign define Vu_error text=! texthl=Error
sign define Vu_active text=> texthl=Comment
sign define Vu_todate text=. texthl=Comment
sign define Vu_updated text=+ texthl=Comment
sign define Vu_new text=+ texthl=Comment
sign define Vu_updated text=* texthl=Comment
sign define Vu_deleted text=- texthl=Comment
sign define Vu_helptags text=* texthl=Comment
endif
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 Bundles:']
call vundle#config#init()
endf

+ 22
- 9
autoload/vundle/config.vim View File

@ -3,6 +3,7 @@ func! vundle#config#bundle(arg, ...)
call s:rtp_rm_a()
call add(g:bundles, bundle)
call s:rtp_add_a()
return bundle
endf
func! vundle#config#init()
@ -13,7 +14,7 @@ endf
func! vundle#config#require(bundles) abort
for b in a:bundles
call s:rtp_add(b.rtpath())
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'
@ -24,7 +25,9 @@ endf
func! vundle#config#init_bundle(name, opts)
let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')))
return extend(opts, copy(s:bundle))
let b = extend(opts, copy(s:bundle))
let b.rtpath = s:rtpath(opts)
return b
endf
func! s:parse_options(opts)
@ -40,10 +43,11 @@ endf
func! s:parse_name(arg)
let arg = a:arg
let git_proto = exists('g:vundle_default_git_proto') ? g:vundle_default_git_proto : 'https'
if arg =~? '^\s*\(gh\|github\):\S\+'
\ || arg =~? '^[a-z0-9][a-z0-9-]*/[^/]\+$'
let uri = 'https://github.com/'.split(arg, ':')[-1]
let uri = git_proto.'://github.com/'.split(arg, ':')[-1]
if uri !~? '\.git$'
let uri .= '.git'
endif
@ -55,17 +59,25 @@ func! s:parse_name(arg)
let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1]
else
let name = arg
let uri = 'https://github.com/vim-scripts/'.name.'.git'
let uri = git_proto.'://github.com/vim-scripts/'.name.'.git'
endif
return {'name': name, 'uri': uri, 'name_spec': arg }
endf
func! s:rtp_rm_a()
call filter(copy(g:bundles), 's:rtp_rm(v:val.rtpath())')
let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
let appends = join(paths, '/after,').'/after'
exec 'set rtp-='.fnameescape(prepends)
exec 'set rtp-='.fnameescape(appends)
endf
func! s:rtp_add_a()
call filter(reverse(copy(g:bundles)), 's:rtp_add(v:val.rtpath())')
let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
let appends = join(paths, '/after,').'/after'
exec 'set rtp^='.fnameescape(prepends)
exec 'set rtp+='.fnameescape(appends)
endf
func! s:rtp_rm(dir) abort
@ -82,12 +94,13 @@ func! s:expand_path(path) abort
return simplify(expand(a:path, 1))
endf
func! s:rtpath(opts)
return has_key(a:opts, 'rtp') ? s:expand_path(a:opts.path().'/'.a:opts.rtp) : a:opts.path()
endf
let s:bundle = {}
func! s:bundle.path()
return s:expand_path(g:bundle_dir.'/'.self.name)
endf
func! s:bundle.rtpath()
return has_key(self, 'rtp') ? s:expand_path(self.path().'/'.self.rtp) : self.path()
endf

+ 72
- 25
autoload/vundle/installer.vim View File

@ -1,7 +1,7 @@
func! vundle#installer#new(bang, ...) abort
let bundles = (a:1 == '') ?
\ g:bundles :
\ map(copy(a:000), 'vundle#config#init_bundle(v:val, {})')
\ 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'])
@ -29,6 +29,10 @@ func! s:process(bang, cmd)
let msg = 'With errors; press l to view log'
endif
if 'updated' == g:vundle_last_status && empty(msg)
let msg = 'Bundles updated; press u to view changelog'
endif
" goto next one
exec ':+1'
@ -53,12 +57,16 @@ func! vundle#installer#run(func_name, name, ...) abort
redraw
if 'updated' == status
if 'new' == status
echo n.' installed'
elseif 'updated' == status
echo n.' updated'
elseif 'todate' == status
echo n.' already installed'
elseif 'deleted' == status
echo n.' deleted'
elseif 'helptags' == status
echo n.' regenerated'
elseif 'error' == status
echohl Error
echo 'Error processing '.n
@ -83,7 +91,8 @@ endf
func! vundle#installer#install_and_require(bang, name) abort
let result = vundle#installer#install(a:bang, a:name)
let b = vundle#config#init_bundle(a:name, {})
let b = vundle#config#bundle(a:name, {})
call vundle#installer#helptags([b])
call vundle#config#require([b])
return result
endf
@ -98,11 +107,11 @@ endf
func! vundle#installer#docs() abort
call vundle#installer#helptags(g:bundles)
return 'updated'
return 'helptags'
endf
func! vundle#installer#helptags(bundles) abort
let bundle_dirs = map(copy(a:bundles),'v:val.rtpath()')
let bundle_dirs = map(copy(a:bundles),'v:val.rtpath')
let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)')
call s:log('')
@ -125,7 +134,9 @@ endf
func! vundle#installer#clean(bang) abort
let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
let all_dirs = split(globpath(g:bundle_dir, '*', 1), "\n")
let all_dirs = (v:version > 702 || (v:version == 702 && has("patch51")))
\ ? split(globpath(g:bundle_dir, '*', 1), "\n")
\ : split(globpath(g:bundle_dir, '*'), "\n")
let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')
if empty(x_dirs)
@ -191,45 +202,55 @@ endf
func! s:has_doc(rtp) abort
return isdirectory(a:rtp.'/doc')
\ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags'))
\ && !(empty(glob(a:rtp.'/doc/*.txt', 1)) && empty(glob(a:rtp.'/doc/*.??x', 1)))
\ && (v:version > 702 || (v:version == 702 && has("patch51")))
\ ? !(empty(glob(a:rtp.'/doc/*.txt', 1)) && empty(glob(a:rtp.'/doc/*.??x', 1)))
\ : !(empty(glob(a:rtp.'/doc/*.txt')) && empty(glob(a:rtp.'/doc/*.??x')))
endf
func! s:helptags(rtp) abort
let doc_path = a:rtp.'/doc/'
call s:log(':helptags '.doc_path)
try
helptags `=doc_path`
execute 'helptags ' . doc_path
catch
call s:log("> Error running :helptags ".doc_path)
endtry
endf
func! s:sync(bang, bundle) abort
let git_dir = expand(a:bundle.path().'/.git/', 1)
let git_dir = expand(a:bundle.path().'/.git', 1)
let is_submodule = isdirectory(git_dir) || filereadable(git_dir)
call s:system('cd '.shellescape(g:bundle_dir).' && git status')
if v:shell_error
if isdirectory(git_dir)
if !(a:bang) | return 'todate' | endif
let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull'
else
let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path())
endif
" Not within a git repo, all bundles must be cloned normally.
let within_repo = 0
else
" Within a git repo, all bundles must be added as submodules.
let within_repo = 1
let top_level = substitute(s:system('cd '.shellescape(g:bundle_dir).' && git rev-parse --show-toplevel'), '\n', '', 'g')
let prefix = substitute(s:system('cd '.shellescape(g:bundle_dir).' && git rev-parse --show-prefix'), '\n', '', 'g')
let relative_path = prefix.substitute(a:bundle.path(), g:bundle_dir.'/', '', '')
if isdirectory(git_dir)
if !(a:bang) | return 'todate' | endif
let cmd = 'cd '.shellescape(top_level).' && git submodule update --merge '.shellescape(relative_path)
else
endif
if is_submodule
if !(a:bang) | return 'todate' | endif
let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull && git submodule update --init --merge --recursive'
let cmd = g:shellesc_cd(cmd)
let get_current_sha = 'cd '.shellescape(a:bundle.path()).' && git rev-parse HEAD'
let get_current_sha = g:shellesc_cd(get_current_sha)
let initial_sha = s:system(get_current_sha)[0:15]
else
if within_repo
let cmd = 'cd '.shellescape(top_level).' && git submodule add '.a:bundle.uri.' '.shellescape(relative_path).' && git submodule init'
else
let cmd = 'git clone --recursive '.shellescape(a:bundle.uri).' '.shellescape(a:bundle.path())
endif
end
if (has('win32') || has('win64'))
let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
let cmd = '"'.cmd.'"' " enclose in quotes
let initial_sha = ''
endif
let out = s:system(cmd)
@ -242,13 +263,39 @@ func! s:sync(bang, bundle) abort
return 'error'
end
if out =~# 'up-to-date'
if empty(initial_sha)
return 'new'
endif
let updated_sha = s:system(get_current_sha)[0:15]
if initial_sha == updated_sha
return 'todate'
end
endif
call add(g:updated_bundles, [initial_sha, updated_sha, a:bundle])
return 'updated'
endf
func! g:shellesc(cmd) abort
if (has('win32') || has('win64'))
if &shellxquote != '(' " workaround for patch #445
return '"'.a:cmd.'"' " enclose in quotes so && joined cmds work
endif
endif
return a:cmd
endf
func! g:shellesc_cd(cmd) abort
if (has('win32') || has('win64'))
let cmd = substitute(a:cmd, '^cd ','cd /d ','') " add /d switch to change drives
let cmd = g:shellesc(cmd)
return cmd
else
return a:cmd
endif
endf
func! s:system(cmd) abort
return system(a:cmd)
endf


+ 46
- 3
autoload/vundle/scripts.vim View File

@ -28,7 +28,48 @@ func! s:view_log()
endif
call writefile(g:vundle_log, g:vundle_log_file)
silent pedit `=g:vundle_log_file`
execute 'silent pedit ' . g:vundle_log_file
wincmd P | wincmd H
endf
func! s:create_changelog() abort
for bundle_data in g:updated_bundles
let initial_sha = bundle_data[0]
let updated_sha = bundle_data[1]
let bundle = bundle_data[2]
let cmd = 'cd '.shellescape(bundle.path()).
\ ' && git log --pretty=format:"%s %an, %ar" --graph '.
\ initial_sha.'..'.updated_sha
let cmd = g:shellesc_cd(cmd)
let updates = system(cmd)
call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Bundle: '.bundle.name)
if bundle.uri =~ "https://github.com"
call add(g:vundle_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)
endfor
endfor
endf
func! s:view_changelog()
call s:create_changelog()
if !exists('g:vundle_changelog_file')
let g:vundle_changelog_file = tempname()
endif
call writefile(g:vundle_changelog, g:vundle_changelog_file)
execute 'silent pedit ' . g:vundle_changelog_file
wincmd P | wincmd H
endf
@ -80,6 +121,7 @@ func! vundle#scripts#view(title, headers, results)
com! -buffer -nargs=0 VundleLog call s:view_log()
com! -buffer -nargs=0 VundleChangelog call s:view_changelog()
nnoremap <buffer> q :silent bd!<CR>
nnoremap <buffer> D :exec 'Delete'.getline('.')<CR>
@ -91,6 +133,7 @@ func! vundle#scripts#view(title, headers, results)
nnoremap <buffer> I :exec 'InstallAndRequire'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '')<CR>
nnoremap <buffer> l :VundleLog<CR>
nnoremap <buffer> u :VundleChangelog<CR>
nnoremap <buffer> h :h vundle<CR>
nnoremap <buffer> ? :norm h<CR>
@ -117,8 +160,8 @@ func! s:fetch_scripts(to)
let temp = shellescape(tempname())
let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.shellescape(a:to)
if (has('win32') || has('win64'))
let cmd = substitute(cmd, 'mv -f ', 'mv /Y ') " change force flag
let cmd = '"'.cmd.'"' " enclose in quotes so && joined cmds work
let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag
let cmd = g:shellesc(cmd)
end
else
echoerr 'Error curl or wget is not available!'


+ 15
- 4
doc/vundle.txt View File

@ -16,6 +16,7 @@ CONTENTS ~
4.6. Cleanup |vundle-scripts-cleanup|
5. Interactive mode |vundle-interactive|
6. Key mappings |vundle-keymappings|
7. Options |vundle-options|
===========================================================================
@ -131,6 +132,7 @@ run >
:BundleInstall! " NOTE: bang(!)
installs or updates configured scripts.
press u after updates complete to see the changelog of all updated bundles.
4.4 SEARCHING ~
*vundle-scripts-search* *BundleSearch*
@ -159,7 +161,7 @@ Searching requires [`curl`](http://curl.haxx.se/)
4.5 LISTING BUNDLES ~
*vundle-scripts-list* *BundleList*
To quickly pull list of configured bundles use >
To quickly pull list of installed bundles use >
:BundleList
@ -170,13 +172,13 @@ run >
:BundleClean
requires confirmation before removal of unused script-dirs from your `.vim/bundle`.
confirms removal of unused script-dirs from `.vim/bundle/`.
*BundleClean!*
>
:BundleClean!
:BundleClean!
removes unused scripts with no questions.
removes unused dirs with no questions.
*vundle-interactive*
@ -219,6 +221,15 @@ KEY | DESCRIPTION
c | run :BundleClean
s | run :BundleSearch
R | fetch fresh script list from server
.
*vundle-options*
7. OPTIONS ~
>
let g:vundle_default_git_proto = 'git'
makes Vundle use `git` instead default `https` when building absolute repo URIs
vim:tw=78:ts=8:ft=help:norl:

+ 20
- 0
test/files/test.erl View File

@ -0,0 +1,20 @@
-module(mmc_logmon_sup).
-behaviour(supervisor).
-export([init/1]).
init(_) ->
{ok, {
{one_for_one, 5, 1},
[
{listener,
{aaa, start_link, []},
permanent, 100, worker,
[aaa]
},
{server,
{bbb, start_link, []},
permanent, 100, worker,
[bbb]
}
]
}}.

+ 8
- 9
test/vimrc View File

@ -5,8 +5,12 @@ set nowrap
let root = '/tmp/!vundle-test/bundles/'
let src = 'http://github.com/gmarik/vundle.git'
" let src = '~/.vim/bundle/vundle/.git'
" Vundle Options
" let g:vundle_default_git_proto = 'git'
if !isdirectory(expand(root, 1).'/vundle')
exec '!git clone '.src.' '.shellescape(root, 1).'/vundle'
endif
@ -54,6 +58,9 @@ Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'}
" Camel case
Bundle 'vim-scripts/RubySinatra'
" syntax issue #203
Bundle 'jimenezrick/vimerl'
filetype plugin indent on " Automatically detect file types.
set wildignore+=doc " should not break helptags
@ -66,12 +73,4 @@ set wildignore+=*/.git/*
au VimEnter * BundleInstall
func! s:assert_bundles() abort
for b in g:bundles
if (!isdirectory(b.path().'/.git/'))
throw b.name.' not installed'
endif
endfor
endf
call s:assert_bundles()
" e test/files/erlang.erl

Loading…
Cancel
Save