Browse Source

Improvements to rtp management and start up.

Several changes:
 * For both Bundle and Plugin fixes the rtp ordering issues, ~/.vim should be first.
 * For Plugin, during vundle#begin/end block use delayed initialization to speed up.
 * After end() works, all plugins should be available.
 * Simply replacing documentation of vundle#rc with begin/end.
pull/418/head
Jeremy Pallats/starcraft.man 12 years ago
parent
commit
efb8450aa8
5 changed files with 106 additions and 68 deletions
  1. +19
    -19
      README.md
  2. +15
    -2
      autoload/vundle.vim
  3. +26
    -4
      autoload/vundle/config.vim
  4. +42
    -35
      doc/vundle.txt
  5. +4
    -8
      test/vimrc

+ 19
- 19
README.md View File

@ -1,4 +1,4 @@
## [Help Maintain Vundle](https://github.com/gmarik/Vundle.vim/issues/241)
## [Help Maintain Vundle](https://github.com/gmarik/Vundle.vim/issues/383)
## About
@ -29,7 +29,8 @@
Installation requires [Git] and triggers [`git clone`] for each configured repository to `~/.vim/bundle/` by default.
Curl is required for search.
If you are using Windows, go directly to [Windows setup]. If you run into any issues, please consult the [FAQ].
If you are using Windows, go directly to [Windows setup]. If you run into any issues, please consult the [FAQ]. Also,
see the [Tips] wiki page for some additional options.
2. Set up [Vundle]:
@ -45,32 +46,31 @@
" 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 plugins
"let path = '~/some/path/here'
"call vundle#rc(path)
call vundle#begin()
" alternatively, pass where Vundle should install plugins
"call vundle#begin('~/some/plugin/directory')
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep Plugin commands between here and filetype plugin indent on.
" scripts on GitHub repos
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.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" scripts from http://vim-scripts.org/vim/scripts.html
" plugins on GitHub repos
Plugin 'tpope/vim-fugitive' "A plugin for git integration
" plugins from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
Plugin 'FuzzyFinder'
" scripts not on GitHub
" plugins not on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" ...
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Plugin will clone to the folder 'finder' inside `~/.vim/bundle`.
" Use to avoid plugin name collisions.
Plugin 'FuzzyFinder', {'name': 'finder'}
" Plugins available after vundle#end() finishes.
call vundle#end()
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
@ -82,7 +82,6 @@
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin commands are not allowed.
" Put your stuff after this line
```
@ -135,6 +134,7 @@ see [Vundle contributors](https://github.com/gmarik/vundle/graphs/contributors)
[Vundle]:http://github.com/gmarik/vundle
[Windows setup]:https://github.com/gmarik/vundle/wiki/Vundle-for-Windows
[FAQ]:https://github.com/gmarik/vundle/wiki
[Tips]:https://github.com/gmarik/Vundle.vim/wiki/Tips-and-Tricks
[Vim]:http://www.vim.org
[Git]:http://git-scm.com
[`git clone`]:http://gitref.org/creating/#clone


+ 15
- 2
autoload/vundle.vim View File

@ -6,7 +6,7 @@
" Plugin Commands
com! -nargs=+ -bar Plugin
\ call vundle#config#bundle(<args>)
\ call vundle#config#bundle_lazy(<args>)
com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginInstall
\ call vundle#installer#new('!' == '<bang>', <q-args>)
@ -56,11 +56,24 @@ sign define Vu_deleted text=- texthl=Comment
sign define Vu_helptags text=* texthl=Comment
endif
func! vundle#begin(...) abort
let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1)
let g:bundles = []
let g:updated_bundles = []
let g:vundle_log = []
let g:vundle_changelog = ['Updated Plugins:']
com! -nargs=+ -bar Plugin call vundle#config#bundle_lazy(<args>)
endf
func! vundle#end(...) abort
call vundle#config#activate_all_plugins()
com! -nargs=+ -bar Plugin call vundle#config#bundle(<args>)
endf
func! vundle#rc(...) abort
let g:bundle_dir = len(a:000) > 0 ? expand(a:1, 1) : expand('$HOME/.vim/bundle', 1)
let g:bundles = []
let g:updated_bundles = []
let g:vundle_log = []
let g:vundle_changelog = ['Updated Plugins:']
call vundle#config#init()
endf

+ 26
- 4
autoload/vundle/config.vim View File

@ -3,13 +3,18 @@ func! vundle#config#bundle(arg, ...)
call s:rtp_rm_a()
call add(g:bundles, bundle)
call s:rtp_add_a()
call s:rtp_add_defaults()
return bundle
endf
func! vundle#config#init()
if !exists('g:bundles') | let g:bundles = [] | endif
call s:rtp_rm_a()
let g:bundles = []
func! vundle#config#bundle_lazy(arg, ...)
call add(s:lazy_bundles, [a:arg, a:000])
endf
func! vundle#config#activate_all_plugins()
call extend(g:bundles, map(s:lazy_bundles, 'vundle#config#init_bundle(v:val[0], v:val[1])'))
call s:rtp_add_a()
call s:rtp_add_defaults()
endf
func! vundle#config#require(bundles) abort
@ -21,6 +26,7 @@ func! vundle#config#require(bundles) abort
exec 'runtime! '.b.name.'/after/*.vim'
call s:rtp_rm(g:bundle_dir)
endfor
call s:rtp_add_defaults()
endf
func! vundle#config#init_bundle(name, opts)
@ -67,6 +73,21 @@ func! s:parse_name(arg)
return {'name': name, 'uri': uri, 'name_spec': arg }
endf
func! s:rtp_add_defaults()
let current = &rtp
set rtp&vim
let default = &rtp
let &rtp = current
for item in reverse(split(default, ','))
exec 'set rtp-=' . item
if item =~ 'after$'
exec 'set rtp+=' . item
else
exec 'set rtp^=' . item
endif
endfor
endf
func! s:rtp_rm_a()
let paths = map(copy(g:bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
@ -102,6 +123,7 @@ func! s:rtpath(opts)
endf
let s:bundle = {}
let s:lazy_bundles = []
func! s:bundle.path()
return s:expand_path(g:bundle_dir.'/'.self.name)


+ 42
- 35
doc/vundle.txt View File

@ -69,41 +69,48 @@ more information.
Put this at the top of your `.vimrc` to use Vundle. Remove bundles you
don't need, they are for illustration purposes.
>
set nocompatible " be iMproved, required
filetype off " required
" 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
"let path = '~/some/path/here'
"call vundle#rc(path)
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep bundle commands between here and filetype plugin indent on.
" plugins on GitHub repos
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.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" plugins from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
Plugin 'FuzzyFinder'
" plugins not on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" ...
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" Put your stuff after this line
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
" alternatively, pass where Vundle should install plugins
"call vundle#begin('~/some/plugin/directory')
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" plugins on GitHub repos
Plugin 'tpope/vim-fugitive' "A plugin for git integration
" plugins from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" plugins not on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Plugin will clone to the folder 'finder' inside ~/.vim/bundle.
" Use to avoid plugin name collisions.
Plugin 'FuzzyFinder', {'name': 'finder'}
" Plugins available after vundle#end() finishes.
call vundle#end()
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :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
" Put your stuff after this line
4. Install configured bundles:


+ 4
- 8
test/vimrc View File

@ -1,10 +1,10 @@
" vim -u test/vimrc
set nocompatible
set nowrap
filetype off
syntax on
let bundle_dir = '/tmp/vundle-test/bundles/'
" let src = 'http://github.com/gmarik/vundle.git'
" Vundle Options
" let g:vundle_default_git_proto = 'git'
@ -12,16 +12,11 @@ let bundle_dir = '/tmp/vundle-test/bundles/'
silent execute '!mkdir -p '.bundle_dir
silent execute '!ln -f -s ~/.vim/bundle/vundle '.bundle_dir
filetype off
syntax on
runtime macros/matchit.vim
" This test should be executed in "test" directory
exec 'set rtp^='.bundle_dir.'vundle/'
call vundle#rc(bundle_dir)
call vundle#begin(bundle_dir)
Plugin 'molokai' " vim-scripts name
@ -58,6 +53,7 @@ Bundle 'vim-scripts/RubySinatra'
" syntax issue #203
Bundle 'jimenezrick/vimerl'
call vundle#end()
filetype plugin indent on " Automatically detect file types.
set wildignore+=doc " should not break helptags


Loading…
Cancel
Save