diff --git a/bundle/vundle/.gitignore b/bundle/vundle/.gitignore new file mode 100644 index 0000000..f276604 --- /dev/null +++ b/bundle/vundle/.gitignore @@ -0,0 +1,2 @@ +doc/tags +.netrwhist diff --git a/bundle/vundle/LICENSE-MIT.txt b/bundle/vundle/LICENSE-MIT.txt new file mode 100644 index 0000000..003904d --- /dev/null +++ b/bundle/vundle/LICENSE-MIT.txt @@ -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. diff --git a/bundle/vundle/README.md b/bundle/vundle/README.md new file mode 100644 index 0000000..afc2250 --- /dev/null +++ b/bundle/vundle/README.md @@ -0,0 +1,141 @@ +## About + +[Vundle] is short for _Vim bundle_ and is a [Vim] plugin manager. + +![Vundle-installer](http://25.media.tumblr.com/tumblr_m8m96w06G81r39828o1_1280.png) + +## Quick start + +1. Set up [Vundle]: + + ``` + $ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle + ``` + +2. Configure bundles: + + Sample `.vimrc`: + + ```vim + set nocompatible " be iMproved + filetype off " required! + + set rtp+=~/.vim/bundle/vundle/ + call vundle#rc() + + " let Vundle manage Vundle + " required! + Bundle 'gmarik/vundle' + + " My bundles here: + " + " original repos on GitHub + 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' + " non-GitHub repos + Bundle 'git://git.wincent.com/command-t.git' + " Git repos on your local machine (i.e. when working on your own plugin) + Bundle 'file:///Users/gmarik/path/to/plugin' + " ... + + filetype plugin indent on " required! + " + " 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 + " + " see :h vundle for more details or wiki for FAQ + " NOTE: comments after Bundle commands are not allowed. + ``` + +3. Install configured bundles: + + 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) + + Installation requires [Git] and triggers [`git clone`](http://gitref.org/creating/#clone) for each configured repo to `~/.vim/bundle/`. + + +## Why Vundle + +[Vundle] allows you to: + +- keep track of and configure your scripts right in `.vimrc` +- [install] configured scripts (a.k.a. bundle) +- [update] configured scripts +- [search] by name [all available Vim scripts] +- [clean] unused scripts up +- run the above actions in a *single keypress* with [interactive mode] + +[Vundle] also: + +- manages the [runtime path] of your installed scripts +- [regenerates help tags][helptags] automatically + +## Docs + +See the [`:h vundle`](https://github.com/gmarik/vundle/blob/master/doc/vundle.txt) Vimdoc for more details. + +## People using Vundle + +see [Examples](https://github.com/gmarik/vundle/wiki/Examples) + +## FAQ + +see [the wiki](https://github.com/gmarik/vundle/wiki#faq) + +## Contributors + +see [Vundle contributors](https://github.com/gmarik/vundle/graphs/contributors) + +*Thank you!* + +## Inspiration and ideas from + +* [pathogen.vim] +* [Bundler] +* [Scott Bronson](http://github.com/bronson) + +## Also + +* Vundle was developed and tested with [Vim] 7.3 on OS X, Linux and Windows +* 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 and patches are appreciated. + +* ✓ activate newly added bundles on `.vimrc` reload or after `:BundleInstall` +* ✓ use preview window for search results +* ✓ Vim documentation +* ✓ put Vundle in `bundles/` too (will fix Vundle help) +* ✓ tests +* ✓ improve error handling +* allow specifying revision/version? +* handle dependencies +* show description in search results +* search by description as well +* make it rock! + +[Vundle]:http://github.com/gmarik/vundle +[pathogen.vim]:http://github.com/tpope/vim-pathogen/ +[Bundler]:https://github.com/bundler/bundler +[Vim]:http://www.vim.org +[Git]:http://git-scm.com +[all available Vim scripts]:http://vim-scripts.org/vim/scripts.html +[helptags]: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#L115-129 +[update]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L131-137 +[search]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L139-161 +[clean]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L171-L183 +[interactive mode]:https://github.com/gmarik/vundle/blob/master/doc/vundle.txt#L186-213 diff --git a/bundle/vundle/autoload/vundle.vim b/bundle/vundle/autoload/vundle.vim new file mode 100644 index 0000000..0bc7bf5 --- /dev/null +++ b/bundle/vundle/autoload/vundle.vim @@ -0,0 +1,48 @@ +" 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.9 + +com! -nargs=+ Bundle +\ call vundle#config#bundle() + +com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall +\ call vundle#installer#new('!' == '', ) + +com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleSearch +\ call vundle#scripts#all('!'=='', ) + +com! -nargs=? -bang -complete=custom,vundle#scripts#complete Bundles +\ call vundle#scripts#all('!'=='', ) + +com! -nargs=0 -bang BundleList +\ call vundle#installer#list('!'=='') + +com! -nargs=? -bang BundleClean +\ call vundle#installer#clean('!' == '') + +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_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 diff --git a/bundle/vundle/autoload/vundle/config.vim b/bundle/vundle/autoload/vundle/config.vim new file mode 100644 index 0000000..5bb6e3f --- /dev/null +++ b/bundle/vundle/autoload/vundle/config.vim @@ -0,0 +1,109 @@ +func! vundle#config#bundle(arg, ...) + let bundle = vundle#config#init_bundle(a:arg, a:000) + call s:rtp_rm_a() + call add(g:bundles, bundle) + call s:rtp_add_a() + return bundle +endf + +func! vundle#config#init() + if !exists('g:bundles') | let g:bundles = [] | endif + call s:rtp_rm_a() + let g:bundles = [] +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) + " 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) + endfor +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 . "'" + endif + let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g'))) + let b = extend(opts, copy(s:bundle)) + let b.rtpath = s:rtpath(opts) + return b +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 + 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 = git_proto.'://github.com/'.split(arg, ':')[-1] + if uri !~? '\.git$' + let uri .= '.git' + endif + let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i') + elseif arg =~? '^\s*\(git@\|git://\)\S\+' + \ || arg =~? '\(file\|https\?\)://' + \ || arg =~? '\.git\s*$' + let uri = arg + let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1] + else + let name = arg + 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() + 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() + 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 + exec 'set rtp-='.fnameescape(expand(a:dir, 1)) + exec 'set rtp-='.fnameescape(expand(a:dir.'/after', 1)) +endf + +func! s:rtp_add(dir) abort + exec 'set rtp^='.fnameescape(expand(a:dir, 1)) + exec 'set rtp+='.fnameescape(expand(a:dir.'/after', 1)) +endf + +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 + diff --git a/bundle/vundle/autoload/vundle/installer.vim b/bundle/vundle/autoload/vundle/installer.vim new file mode 100644 index 0000000..bc807c3 --- /dev/null +++ b/bundle/vundle/autoload/vundle/installer.vim @@ -0,0 +1,280 @@ +func! vundle#installer#new(bang, ...) abort + let bundles = (a:1 == '') ? + \ g:bundles : + \ 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 s:process(a:bang, (a:bang ? 'add!' : 'add')) + + call vundle#config#require(bundles) +endf + + +func! s:process(bang, cmd) + let msg = '' + + redraw + sleep 1m + + let lines = (getline('.','$')[0:-2]) + + for line in lines + redraw + + exec ':norm '.a:cmd + + if 'error' == g:vundle_last_status + 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' + + setl nomodified + endfor + + redraw + echo 'Done! '.msg +endf + +func! vundle#installer#run(func_name, name, ...) abort + let n = a:name + + echo 'Processing '.n + call s:sign('active') + + sleep 1m + + let status = call(a:func_name, a:1) + + call s:sign(status) + + redraw + + 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 + echohl None + sleep 1 + else + throw 'whoops, unknown status:'.status + endif + + let g:vundle_last_status = status + + return status +endf + +func! s:sign(status) + if (!has('signs')) + return + endif + + exe ":sign place ".line('.')." line=".line('.')." name=Vu_". a:status ." buffer=" . bufnr("%") +endf + +func! vundle#installer#install_and_require(bang, name) abort + let result = vundle#installer#install(a:bang, a:name) + let b = vundle#config#bundle(a:name, {}) + call vundle#installer#helptags([b]) + call vundle#config#require([b]) + return result +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, {}) + + return s:sync(a:bang, b) +endf + +func! vundle#installer#docs() abort + let error_count = vundle#installer#helptags(g:bundles) + if error_count > 0 + return 'error' + endif + return 'helptags' +endf + +func! vundle#installer#helptags(bundles) abort + let bundle_dirs = map(copy(a:bundles),'v:val.rtpath') + let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)') + + call s:log('') + call s:log('Helptags:') + + 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') + + 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) + redraw + echo len(g:bundles).' bundles configured' +endf + + +func! vundle#installer#clean(bang) abort + 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") + let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') + + if empty(x_dirs) + let headers = ['" All clean!'] + let names = [] + else + let headers = ['" Removing bundles:'] + let names = vundle#scripts#bundle_names(map(copy(x_dirs), 'fnamemodify(v:val, ":t")')) + end + + call vundle#scripts#view('clean', headers, names) + redraw + + if (a:bang || empty(names)) + call s:process(a:bang, 'D') + else + call inputsave() + let response = input('Continue? [Y/n]: ') + call inputrestore() + if (response =~? 'y' || response == '') + call s:process(a:bang, 'D') + endif + endif +endf + + +func! vundle#installer#delete(bang, dir_name) abort + + let cmd = ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) ? + \ 'rmdir /S /Q' : + \ 'rm -rf' + + let bundle = vundle#config#init_bundle(a:dir_name, {}) + let cmd .= ' '.shellescape(bundle.path()) + + let out = s:system(cmd) + + call s:log('') + call s:log('Bundle '.a:dir_name) + call s:log('$ '.cmd) + call s:log('> '.out) + + if 0 != v:shell_error + return 'error' + else + return 'deleted' + endif +endf + +func! s:has_doc(rtp) abort + return isdirectory(a:rtp.'/doc') + \ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags')) + \ && (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 + execute 'helptags ' . resolve(doc_path) + catch + call s:log("> Error running :helptags ".doc_path) + return 0 + endtry + return 1 +endf + +func! s:sync(bang, bundle) abort + let git_dir = expand(a:bundle.path().'/.git/', 1) + if isdirectory(git_dir) || filereadable(expand(a:bundle.path().'/.git', 1)) + if !(a:bang) | return 'todate' | endif + let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull && git submodule update --init --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 + let cmd = 'git clone --recursive '.shellescape(a:bundle.uri).' '.shellescape(a:bundle.path()) + let initial_sha = '' + endif + + let out = s:system(cmd) + call s:log('') + call s:log('Bundle '.a:bundle.name_spec) + call s:log('$ '.cmd) + call s:log('> '.out) + + if 0 != v:shell_error + return 'error' + end + + if empty(initial_sha) + return 'new' + endif + + let updated_sha = s:system(get_current_sha)[0:15] + + if initial_sha == updated_sha + return 'todate' + 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')) && empty(matchstr(&shell, 'sh'))) + 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')) && empty(matchstr(&shell, 'sh'))) + 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 + +func! s:log(str) abort + let fmt = '%y%m%d %H:%M:%S' + call add(g:vundle_log, '['.strftime(fmt).'] '.a:str) + return a:str +endf diff --git a/bundle/vundle/autoload/vundle/scripts.vim b/bundle/vundle/autoload/vundle/scripts.vim new file mode 100644 index 0000000..ded6a46 --- /dev/null +++ b/bundle/vundle/autoload/vundle/scripts.vim @@ -0,0 +1,188 @@ +func! vundle#scripts#all(bang, ...) + let b:match = '' + let info = ['"Keymap: i - Install bundle; c - Cleanup; s - Search; R - Reload list'] + let matches = s:load_scripts(a:bang) + if !empty(a:1) + let matches = filter(matches, 'v:val =~? "'.escape(a:1,'"').'"') + let info += ['"Search results for: '.a:1] + " TODO: highlight matches + let b:match = a:1 + endif + call vundle#scripts#view('search',info, vundle#scripts#bundle_names(reverse(matches))) + redraw + echo len(matches).' bundles found' +endf + +func! vundle#scripts#reload() abort + silent exec ':BundleSearch! '.(exists('b:match') ? b:match : '') + redraw +endf + +func! vundle#scripts#complete(a,c,d) + return join(s:load_scripts(0),"\n") +endf + +func! s:view_log() + if !exists('g:vundle_log_file') + let g:vundle_log_file = tempname() + endif + + call writefile(g:vundle_log, 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 + +func! vundle#scripts#bundle_names(names) + return map(copy(a:names), ' printf("Bundle ' ."'%s'".'", v:val) ') +endf + +func! vundle#scripts#view(title, headers, results) + if exists('g:vundle_view') && bufloaded(g:vundle_view) + exec g:vundle_view.'bd!' + endif + + exec 'silent pedit [Vundle] '.a:title + + wincmd P | wincmd H + + let g:vundle_view = bufnr('%') + " + " make buffer modifiable + " to append without errors + set modifiable + + call append(0, a:headers + a:results) + + setl buftype=nofile + setl noswapfile + + setl cursorline + setl nonu ro noma ignorecase + if (exists('&relativenumber')) | setl norelativenumber | endif + + setl ft=vundle + setl syntax=vim + syn keyword vimCommand Bundle + syn keyword vimCommand Helptags + + com! -buffer -bang -nargs=1 DeleteBundle + \ call vundle#installer#run('vundle#installer#delete', split(,',')[0], ['!' == '', ]) + + com! -buffer -bang -nargs=? InstallAndRequireBundle + \ call vundle#installer#run('vundle#installer#install_and_require', split(,',')[0], ['!' == '', ]) + + com! -buffer -bang -nargs=? InstallBundle + \ call vundle#installer#run('vundle#installer#install', split(,',')[0], ['!' == '', ]) + + com! -buffer -bang -nargs=0 InstallHelptags + \ call vundle#installer#run('vundle#installer#docs', 'helptags', []) + + com! -buffer -nargs=0 VundleLog call s:view_log() + + com! -buffer -nargs=0 VundleChangelog call s:view_changelog() + + nnoremap q :silent bd! + nnoremap D :exec 'Delete'.getline('.') + + nnoremap add :exec 'Install'.getline('.') + nnoremap add! :exec 'Install'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '') + + nnoremap i :exec 'InstallAndRequire'.getline('.') + nnoremap I :exec 'InstallAndRequire'.substitute(getline('.'), '^Bundle ', 'Bundle! ', '') + + nnoremap l :VundleLog + nnoremap u :VundleChangelog + nnoremap h :h vundle + nnoremap ? :norm h + + nnoremap c :BundleClean + nnoremap C :BundleClean! + + nnoremap s :BundleSearch + nnoremap R :call vundle#scripts#reload() + + " goto first line after headers + exec ':'.(len(a:headers) + 1) +endf + +func! s:fetch_scripts(to) + let scripts_dir = fnamemodify(expand(a:to, 1), ":h") + if !isdirectory(scripts_dir) + call mkdir(scripts_dir, "p") + endif + + let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json' + if executable("curl") + let cmd = 'curl --fail -s -o '.shellescape(a:to).' '.l:vim_scripts_json + elseif executable("wget") + 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 ', 'move /Y ', '') " change force flag + let cmd = g:shellesc(cmd) + end + else + echoerr 'Error curl or wget is not available!' + return 1 + endif + + call system(cmd) + + if (0 != v:shell_error) + echoerr 'Error fetching scripts!' + return v:shell_error + endif + return 0 +endf + +func! s:load_scripts(bang) + let f = expand(g:bundle_dir.'/.vundle/script-names.vim-scripts.org.json', 1) + if a:bang || !filereadable(f) + if 0 != s:fetch_scripts(f) + return [] + end + endif + return eval(readfile(f, 'b')[0]) +endf diff --git a/bundle/vundle/doc/vundle.txt b/bundle/vundle/doc/vundle.txt new file mode 100644 index 0000000..bb4ea4f --- /dev/null +++ b/bundle/vundle/doc/vundle.txt @@ -0,0 +1,237 @@ +*vundle.txt* Vundle the plug-in manager for Vim. *vundle* + +CONTENTS ~ + *vundle-contents* +=========================================================================== + +1. About |vundle-about| +2. Why Vundle |vundle-why-vundle| +3. Quick start |vundle-quickstart| +4. Scripts |vundle-scripts| + 4.1. Configure scripts |vundle-scripts-configure| + 4.2. Installing scripts |vundle-scripts-install| + 4.3. Updating scripts |vundle-scripts-update| + 4.4. Searching scripts |vundle-scripts-search| + 4.5. Listing scripts |vundle-scripts-list| + 4.6. Cleanup |vundle-scripts-cleanup| +5. Interactive mode |vundle-interactive| +6. Key mappings |vundle-keymappings| +7. Options |vundle-options| + +=========================================================================== + +ABOUT *vundle-about* + +Vundle is a short cut for Vim bundle and is the Vim plug-in manager. + +2. WHY VUNDLE ~ + *vundle-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 up from unused scripts + +Also *Vundle* : + +- manages runtime path of your installed scripts +- regenerates helptags automatically + +Vundle takes advantage of [vim-scripts.org](http://vim-scripts.org) +in order to install/search [all available vim scripts] + +3. QUICK START ~ + *vundle-quickstart* +1) Setup Vundle: > + + git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle + +2) Configure bundles: + + Sample `.vimrc`: > + + set nocompatible " be iMproved + filetype off " required! + + set rtp+=~/.vim/vundle.git/ + call vundle#rc() + + " let Vundle manage Vundle + Bundle 'gmarik/vundle' + + " My Bundles here: + " + " original repos on github + Bundle 'tpope/vim-fugitive' + Bundle 'Lokaltog/vim-easymotion' + Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} + " vim-scripts repos + Bundle 'L9' + Bundle 'FuzzyFinder' + Bundle 'rails.vim' + " non github repos + Bundle 'git://git.wincent.com/command-t.git' + " git repos on your local machine (ie. when working on your own plugin) + Bundle 'file:///Users/gmarik/path/to/plugin' + " ... + + filetype plugin indent on " required! + " or + " filetype plugin on " to not use the indentation settings set by plugins + +3) Install configured bundles: + + Launch `vim`, run > + + :BundleInstall + +Installing requires [Git] and triggers [Git clone](http://gitref.org/creating/#clone) for +each configured repo to `~/.vim/bundle/`. + +4. SCRIPTS ~ + *vundle-scripts* +4.1 CONFIGURE SCRIPTS ~ + *vundle-scripts-configure* *Bundle* +Before installing scripts they need to be configured. It's done using `Bundle` +command in `.vimrc`: > + + Bundle 'git_repo_uri' " 'git_repo_uri' should be a valid uri to git repository +or > + Bundle 'script_name' " 'script-name' should be an official script name (see |vundle-scripts-search| ) + +Vundle loves Github, that's why short uris can be used with commands: > + + Bundle 'tpope/vim-fugitive' + +equals full uri > + + Bundle 'http://github.com/tpope/vim-fugitive.git' + +NOTE: Vundle defaults to http:// protocol for the short URIs + + +4.2 INSTALL SCRIPTS ~ + *vundle-scripts-install* *BundleInstall* +run > + :BundleInstall + +installs configured scripts. Newly installed scripts will be automatically +enabled. Except special cases requiring compilation or pre-configuration. + +BundleInstall allows to install scripts by name:> + + :BundleInstall unite.vim + +installs and activates unite.vim. You can use Tab to auto-complete known script names. +NOTE: installation, as just described, doesn't automatically configure scripts; +you have to configure them manually. + +4.3 UPDATE SCRIPTS ~ + *vundle-scripts-update* *BundleInstall!* +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* +run > + :BundleSearch foo + +lists bundles matching 'foo' in new a new split window, ie: +> + Bundle "VimFootnotes" + Bundle "foo.vim" +> +and > + + :BundleSearch! foo + +refreshes script list before performing actual search. + +If command is run without argument: > + + :BundleSearch! + +it will display all known scripts + +Searching requires [`curl`](http://curl.haxx.se/) + +4.5 LISTING BUNDLES ~ + *vundle-scripts-list* *BundleList* + +To quickly pull list of installed bundles use > + + :BundleList + + +4.6 CLEANING UP ~ + *vundle-scripts-cleanup* *BundleClean* +run > + + :BundleClean + +confirms removal of unused script-dirs from `.vim/bundle/`. + + *BundleClean!* +> + :BundleClean! + +removes unused dirs with no questions. + + + *vundle-interactive* +5. INTERACTIVE MODE ~ + +Vundle provides simple interactive mode to help you explore new scripts easily. +Interactive mode is available as result of any commands that display list of +bundles. For instance, running: > + + :BundleSearch! unite + +triggers search for scripts matching 'unite' and yields a split window with +content: > + + "Keymap: i - Install bundle; c - Cleanup; r - Refine list; R - Reload list + "Search results for: unite + Bundle 'unite.vim' + Bundle 'unite-yarm' + Bundle 'unite-gem' + Bundle 'unite-locate' + Bundle 'unite-font' + Bundle 'unite-colorscheme' + +As the first line(starting with `"Keymap:`) shows, certain actions may be applied +to selected bundles . Move cursor over line `Bundle 'unite.vim'` and press i +key(install, see |vundle-keymappings| for more details). +After unite.vim is installed - `:Unite file` command should be +available to prove 'unite.vim' availability. + +NOTE: Interactive installation doesn't update your .vimrc configuration. + + *vundle-keymappings* +6. KEY MAPPINGS ~ + +KEY | DESCRIPTION +----|-------------------------- > + i | run :BundleInstall with name taken from line cursor is positioned on + I | same as i, but runs :BundleInstall! to update bundle + D | delete selected bundle( be careful not to remove local modifications) + 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: diff --git a/bundle/vundle/test/files/test.erl b/bundle/vundle/test/files/test.erl new file mode 100644 index 0000000..1672953 --- /dev/null +++ b/bundle/vundle/test/files/test.erl @@ -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] + } + ] + }}. diff --git a/bundle/vundle/test/minirc.vim b/bundle/vundle/test/minirc.vim new file mode 100644 index 0000000..352d9bc --- /dev/null +++ b/bundle/vundle/test/minirc.vim @@ -0,0 +1,8 @@ +set nocompatible +syntax on +filetype off +set rtp+=~/.vim/bundle/vundle/ +call vundle#rc() +Bundle 'gmarik/vundle' +filetype plugin indent on + diff --git a/bundle/vundle/test/vimrc b/bundle/vundle/test/vimrc new file mode 100644 index 0000000..662709f --- /dev/null +++ b/bundle/vundle/test/vimrc @@ -0,0 +1,76 @@ +" vim -u test/vimrc +set nocompatible + +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 + +filetype off +syntax on + +runtime macros/matchit.vim + +exec 'set rtp+='.root.'/vundle' + +call vundle#rc(root) + +Bundle "gmarik/vundle" + +" vim-scripts name +Bundle 'molokai' + +" github username with dashes +Bundle 'vim-scripts/ragtag.vim' + +" original repo +Bundle 'altercation/vim-colors-solarized' +" with extension +Bundle 'nelstrom/vim-mac-classic-theme.git' +" +" invalid uri +Bundle 'nonexistinguser/yupppierepo.git' + +" full uri +Bundle 'https://github.com/vim-scripts/vim-game-of-life' +" full uri +Bundle 'git@github.com:gmarik/ingretu.git' +" short uri +Bundle 'gh:gmarik/snipmate.vim.git' +Bundle 'github:mattn/gist-vim.git' + +" local uri stuff +Bundle '~/Dropbox/.gitrepos/utilz.vim.git' +" Bundle 'file://Dropbox/.gitrepos/utilz.vim.git' + +" with options +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 +set wildignore+=.git " should not break clone +set wildignore+=.git/* " should not break clone +set wildignore+=*/.git/* +" TODO: helptags fails with this +" set wildignore+=doc/* " should not break clone +" set wildignore+=*/doc/* + +au VimEnter * BundleInstall + +" e test/files/erlang.erl