Bundling by name and Search
This commit is contained in:
parent
478efb7de7
commit
b611dad6e1
66
README.md
66
README.md
@ -2,37 +2,60 @@
|
|||||||
|
|
||||||
[Vundle] is a short cut for **V**imb**undle** and is a ~80 LOC plugin for managing [Vim] plugins.
|
[Vundle] is a short cut for **V**imb**undle** and is a ~80 LOC plugin for managing [Vim] plugins.
|
||||||
|
|
||||||
|
## Why
|
||||||
|
[Vundle] can:
|
||||||
|
- automatically install vim script (aka bundle)
|
||||||
|
- manage runtime path of your installed scripts so you don't have to
|
||||||
|
- disable/enable bundles by commenting/uncommenting configured Bundle(requires reload)
|
||||||
|
- NEW: search [all available vim scripts] by name
|
||||||
|
|
||||||
## Installation
|
[Vundle] takes advantage of [vim-scripts.org](http://vim-scripts.org)
|
||||||
|
in order to install/search [all available vim scripts]
|
||||||
|
|
||||||
mkdir -p ~/.vim/autoload/ && \
|
## How
|
||||||
curl http://github.com/gmarik/vundle/raw/master/autoload/vundle.vim > ~/.vim/autoload/vundle.vim
|
|
||||||
|
|
||||||
## Configuration
|
1. Setup [Vundle]:
|
||||||
|
|
||||||
Add to your <code>~/.vimrc</code>
|
git clone http://github.com/gmarik/vundle.git > ~/.vim/vundle.vim
|
||||||
|
|
||||||
|
2. Configure bundles:
|
||||||
|
|
||||||
|
Add to your <code>~/.vimrc</code>:
|
||||||
|
|
||||||
|
set rtp+=~/.vim/vundle.git/
|
||||||
call vundle#rc()
|
call vundle#rc()
|
||||||
|
|
||||||
" My bundles
|
" My bundles
|
||||||
" Bundle "<git-repo-uri>"
|
Bundle "L9"
|
||||||
Bundle "http://github.com/vim-scripts/L9.git"
|
Bundle "FuzzyFinder"
|
||||||
Bundle "http://github.com/vim-scripts/FuzzyFinder.git"
|
Bundle "rails.vim"
|
||||||
|
Bundle "ack.vim"
|
||||||
Bundle "git://git.wincent.com/command-t.git"
|
Bundle "git://git.wincent.com/command-t.git"
|
||||||
Bundle "http://github.com/vim-scripts/rails.vim.git"
|
|
||||||
Bundle "http://github.com/vim-scripts/ack.vim.git"
|
|
||||||
" check http://vim-scripts.org for more
|
" check http://vim-scripts.org for more
|
||||||
|
|
||||||
BTW [Vim-Scripts.org](http://vim-scripts.org) is a git mirror of all vim scripts. See [gmarik's vimrc](http://github.com/gmarik/vimfiles/blob/6926a7e2ba176a292a8e71b6e4c17f15b8eebe04/vimrc#L134) for working example.
|
3. Install configured bundles:
|
||||||
|
|
||||||
## Installing plugins
|
Launch <code>vim</code> and run <code>:BundleInstall</code>.
|
||||||
|
|
||||||
Launch <code>vim</code> and run <code>:BundleInstall</code>.
|
Or from command line:
|
||||||
|
|
||||||
Or from command line:
|
|
||||||
|
|
||||||
$ vim -e -c 'BundleInstall' -c 'q'
|
$ vim -e -c 'BundleInstall' -c 'q'
|
||||||
|
|
||||||
triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo to <code>~/.vim/bundle/</code>.
|
triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo to <code>~/.vim/bundle/</code>.
|
||||||
|
|
||||||
|
See [gmarik's vimrc](https://github.com/gmarik/vimfiles/blob/1f4f26d42f54443f1158e0009746a56b9a28b053/vimrc#L136) for working example.
|
||||||
|
|
||||||
|
## Searching
|
||||||
|
|
||||||
|
:BundleSearch Finder
|
||||||
|
|
||||||
|
Will split new window with results:
|
||||||
|
|
||||||
|
Bundle "FuzzyFinder"
|
||||||
|
Bundle "Indent-Finder"
|
||||||
|
Bundle "cHeaderFinder"
|
||||||
|
|
||||||
|
So you can just copy one you need to you <code>.vimrc</code>
|
||||||
|
|
||||||
## Inspiration and ideas from
|
## Inspiration and ideas from
|
||||||
|
|
||||||
@ -41,12 +64,19 @@ triggers [Git clone](http://gitref.org/creating/#clone) for each configured repo
|
|||||||
* [Scott Bronson](http://github.com/bronson)
|
* [Scott Bronson](http://github.com/bronson)
|
||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
|
[Vundle] is a work in progress so any ideas/patches appreciated
|
||||||
|
|
||||||
* improve code
|
* tests
|
||||||
* support non [Git] resources aswell
|
* allow specify revision/version?
|
||||||
|
* activate newly added bundles on .vimrc reload
|
||||||
|
* search by description aswell
|
||||||
|
* show descrption in search results
|
||||||
|
* use location list/quick fix list for search results
|
||||||
|
* make it rock!
|
||||||
|
|
||||||
[Vundle]:http://github.com/gmarik/vundle
|
[Vundle]:http://github.com/gmarik/vundle
|
||||||
[Pathogen]:http://github.com/tpope/vim-pathogen/
|
[Pathogen]:http://github.com/tpope/vim-pathogen/
|
||||||
[Bundler]:http://github.com/wycats/bundler/
|
[Bundler]:http://github.com/wycats/bundler/
|
||||||
[Vim]:http://vim.org
|
[Vim]:http://vim.org
|
||||||
[Git]:http://git-scm.com
|
[Git]:http://git-scm.com
|
||||||
|
[all available vim scripts]:http://vim-scripts.org/scripts.html
|
||||||
|
@ -1,34 +1,49 @@
|
|||||||
" vundle.vim - is a shortcut for Vim Bundle and Is a simple plugin manager for Vim
|
" vundle.vim - is a shortcut for Vim Bundle and Is a simple plugin manager for Vim
|
||||||
" Maintainer: http://github.com/gmarik
|
" Maintainer: http://github.com/gmarik
|
||||||
" Version: 0.1
|
" Version: 0.2
|
||||||
" Readme: http://github.com/gmarik/vundle/blob/master/README.md
|
" Readme: http://github.com/gmarik/vundle/blob/master/README.md
|
||||||
|
|
||||||
if exists("g:vundle_loaded") || &cp | finish | endif
|
|
||||||
let g:vundle_loaded = 1
|
|
||||||
|
|
||||||
au BufRead,BufNewFile {bundlerc} set ft=vim
|
|
||||||
|
|
||||||
com! -nargs=+ Bundle call vundle#add_bundle(<args>)
|
com! -nargs=+ Bundle call vundle#add_bundle(<args>)
|
||||||
com! -nargs=0 BundleInstall call vundle#install_bundles()
|
com! -nargs=0 BundleInstall call vundle#install_bundles()
|
||||||
com! -nargs=0 BundleDocs call vundle#helptagify_bundles()
|
com! -nargs=0 BundleDocs call vundle#helptagify_bundles()
|
||||||
|
|
||||||
let g:bundle_dir = expand('~/.vim/bundle/')
|
com! -nargs=* BundleSearch call vundle#scripts#search(<q-args>)
|
||||||
|
|
||||||
func! vundle#rc()
|
func! vundle#rc()
|
||||||
|
let g:bundle_dir = expand('$HOME/.vim/bundle/')
|
||||||
let g:bundles = []
|
let g:bundles = []
|
||||||
endf
|
endf
|
||||||
|
|
||||||
func! vundle#add_bundle(...)
|
func! vundle#add_bundle(...)
|
||||||
let [uri; rest] = a:000 | let opts = {}
|
let [arg; rest] = a:000 | let opts = {}
|
||||||
if len(rest) == 1 | let opts = rest[0] | endif
|
if len(rest) == 1 | let opts = rest[0] | endif
|
||||||
let bundle = vundle#new_bundle(uri, opts)
|
" try
|
||||||
|
let bundle = vundle#new_bundle(arg, opts)
|
||||||
call vundle#require_bundle(bundle)
|
call vundle#require_bundle(bundle)
|
||||||
|
" catch | echo 'Error: loadin '.arg | endtry
|
||||||
endf
|
endf
|
||||||
|
|
||||||
func! vundle#new_bundle(uri, opts)
|
func! vundle#init_bundle(arg, opts)
|
||||||
let bundle = a:opts
|
let bundle = a:opts | let arg = a:arg
|
||||||
let bundle.uri = a:uri
|
if arg =~ '^\s*\d\+\s*$' || type(arg) == type(42) " script id
|
||||||
let bundle.name = split(a:uri,'\/')[-1]
|
let bundle.name = vundle#scripts#find(arg)
|
||||||
|
let bundle.uri = vundle#script_uri(bundle.name)
|
||||||
|
elseif arg =~ '^\s*\(git@\|git://\)\S\+' || arg =~ 'https\?://' || arg =~ '\.git\*$'
|
||||||
|
let bundle.uri = arg
|
||||||
|
let bundle.name = substitute(split(bundle.uri,'\/')[-1], '\.git\s*$','','i')
|
||||||
|
else
|
||||||
|
let bundle.name = arg
|
||||||
|
let bundle.uri = vundle#script_uri(bundle.name)
|
||||||
|
endif
|
||||||
|
return bundle
|
||||||
|
endf
|
||||||
|
|
||||||
|
func! vundle#script_uri(name)
|
||||||
|
return 'http://github.com/vim-scripts/'.a:name.'.git'
|
||||||
|
endf
|
||||||
|
|
||||||
|
func! vundle#new_bundle(arg, opts)
|
||||||
|
let bundle = vundle#init_bundle(a:arg, a:opts)
|
||||||
let bundle.path = expand(g:bundle_dir.''.bundle.name)
|
let bundle.path = expand(g:bundle_dir.''.bundle.name)
|
||||||
let bundle.rtpath = has_key(bundle, 'rtp') ? join([bundle.path, bundle.rtp], '/') : bundle.path
|
let bundle.rtpath = has_key(bundle, 'rtp') ? join([bundle.path, bundle.rtp], '/') : bundle.path
|
||||||
call add(g:bundles, bundle)
|
call add(g:bundles, bundle)
|
||||||
@ -68,3 +83,4 @@ func! vundle#helptagify_bundles()
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user