Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add command to explore bundle dir #467

Open
wants to merge 19 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Expand Up @@ -20,7 +20,7 @@

[Vundle] is undergoing an [interface change], please stay up to date to get latest changes.

[![Gitter-chat](https://badges.gitter.im/gmarik/Vundle.vim.png)](https://gitter.im/gmarik/Vundle.vim) for discussion and support.
[![Gitter-chat](https://badges.gitter.im/gmarik/Vundle.vim.svg)](https://gitter.im/gmarik/Vundle.vim) for discussion and support.

![Vundle-installer](http://i.imgur.com/Rueh7Cc.png)

Expand All @@ -34,6 +34,8 @@
If you are using Windows, go directly to [Windows setup]. If you run into any issues, please consult the [FAQ].
See [Tips] for some advanced configurations.

Using non-POSIX shells, such as the popular Fish shell, requires additional setup. Please check the [FAQ].

2. Set up [Vundle]:

`$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim`
Expand Down Expand Up @@ -78,10 +80,10 @@
"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
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
Expand Down
32 changes: 21 additions & 11 deletions autoload/vundle.vim
Expand Up @@ -8,8 +8,8 @@
com! -nargs=+ -bar Plugin
\ call vundle#config#bundle(<args>)

com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginInstall
\ call vundle#installer#new('!' == '<bang>', <q-args>)
com! -nargs=* -bang -complete=custom,vundle#scripts#complete PluginInstall
\ call vundle#installer#new('!' == '<bang>', <f-args>)

com! -nargs=? -bang -complete=custom,vundle#scripts#complete PluginSearch
\ call vundle#scripts#all('!' == '<bang>', <q-args>)
Expand All @@ -21,17 +21,21 @@ com! -nargs=? -bang PluginClean
\ call vundle#installer#clean('!' == '<bang>')

com! -nargs=0 PluginDocs
\ call vundle#installer#helptags(g:bundles)
\ call vundle#installer#helptags(g:vundle#bundles)

com! -nargs=? -complete=custom,vundle#scripts#complete PluginExplore
\ call vundle#scripts#explore(<q-args>)

" Aliases
com! PluginUpdate PluginInstall!
com! -nargs=* -complete=custom,vundle#scripts#complete PluginUpdate PluginInstall! <args>

" Vundle Aliases
com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleInstall PluginInstall<bang> <args>
com! -nargs=? -bang -complete=custom,vundle#scripts#complete VundleSearch PluginSearch<bang> <args>
com! -nargs=? -bang VundleClean PluginClean<bang>
com! -nargs=0 VundleDocs PluginDocs
com! VundleUpdate PluginInstall!
com! -nargs=* -complete=custom,vundle#scripts#complete VundleUpdate PluginInstall! <args>
com! -nargs=? -complete=custom,vundle#scripts#complete VundleExplore PluginExplore <args>

" Deprecated Commands
com! -nargs=+ Bundle call vundle#config#bundle(<args>)
Expand Down Expand Up @@ -60,24 +64,30 @@ endif
" :Plugin command in the vimrc. It is not possible to do this automatically
" because when loading the vimrc file no plugins where loaded yet.
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 Plugins:']
if a:0 > 0
let g:vundle#bundle_dir = expand(a:1, 1)
endif
call vundle#config#init()
endf

" Alternative to vundle#rc, offers speed up by modifying rtp only when end()
" called later.
func! vundle#begin(...) abort
let g:vundle_lazy_load = 1
let g:vundle#lazy_load = 1
call call('vundle#rc', a:000)
endf

" Finishes putting plugins on the rtp.
func! vundle#end(...) abort
unlet g:vundle_lazy_load
unlet g:vundle#lazy_load
call vundle#config#activate_bundles()
endf

" Initialize some global variables used by Vundle.
let vundle#bundle_dir = expand('$HOME/.vim/bundle', 1)
let vundle#bundles = []
let vundle#lazy_load = 0
let vundle#log = []
let vundle#updated_bundles = []

" vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl:
31 changes: 17 additions & 14 deletions autoload/vundle/config.vim
Expand Up @@ -10,11 +10,11 @@ func! vundle#config#bundle(arg, ...)
if !s:check_bundle_name(bundle)
return
endif
if exists('g:vundle_lazy_load') && g:vundle_lazy_load
call add(g:bundles, bundle)
if exists('g:vundle#lazy_load') && g:vundle#lazy_load
call add(g:vundle#bundles, bundle)
else
call s:rtp_rm_a()
call add(g:bundles, bundle)
call add(g:vundle#bundles, bundle)
call s:rtp_add_a()
call s:rtp_add_defaults()
endif
Expand All @@ -40,10 +40,10 @@ endf
" once.
" ---------------------------------------------------------------------------
func! vundle#config#init()
if !exists('g:bundles') | let g:bundles = [] | endif
if !exists('g:vundle#bundles') | let g:vundle#bundles = [] | endif
call s:rtp_rm_a()
let g:bundles = []
let g:bundle_names = {}
let g:vundle#bundles = []
let s:bundle_names = {}
endf


Expand All @@ -55,11 +55,11 @@ 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)
call s:rtp_add(g:vundle#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)
call s:rtp_rm(g:vundle#bundle_dir)
endfor
call s:rtp_add_defaults()
endf
Expand Down Expand Up @@ -91,14 +91,17 @@ endf
" return -- 0 if the bundle's name has been seen before, 1 otherwise
" ---------------------------------------------------------------------------
funct! s:check_bundle_name(bundle)
if has_key(g:bundle_names, a:bundle.name)
if has_key(s:bundle_names, a:bundle.name)
echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec .
\ '. Plugin ' . g:bundle_names[a:bundle.name] .
\ '. Plugin ' . s:bundle_names[a:bundle.name] .
\ ' previously used the name "' . a:bundle.name . '"' .
\ '. Skipping Plugin ' . a:bundle.name_spec . '.'
return 0
elseif a:bundle.name !~ '\v^[A-Za-z0-9_-]%(\.?[A-Za-z0-9_-])*$'
echoerr 'Invalid plugin name: ' . a:bundle.name
return 0
endif
let g:bundle_names[a:bundle.name] = a:bundle.name_spec
let s:bundle_names[a:bundle.name] = a:bundle.name_spec
return 1
endf

Expand Down Expand Up @@ -180,7 +183,7 @@ endf
" runtimepath.
" ---------------------------------------------------------------------------
func! s:rtp_rm_a()
let paths = map(copy(g:bundles), 'v:val.rtpath')
let paths = map(copy(g:vundle#bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
let appends = join(paths, '/after,').'/after'
exec 'set rtp-='.fnameescape(prepends)
Expand All @@ -193,7 +196,7 @@ endf
" runtimepath.
" ---------------------------------------------------------------------------
func! s:rtp_add_a()
let paths = map(copy(g:bundles), 'v:val.rtpath')
let paths = map(copy(g:vundle#bundles), 'v:val.rtpath')
let prepends = join(paths, ',')
let appends = join(paths, '/after,').'/after'
exec 'set rtp^='.fnameescape(prepends)
Expand Down Expand Up @@ -262,7 +265,7 @@ let s:bundle = {}
" return -- the target location to clone this bundle to
" ---------------------------------------------------------------------------
func! s:bundle.path()
return s:expand_path(g:bundle_dir.'/'.self.name)
return s:expand_path(g:vundle#bundle_dir.'/') . self.name
endf


Expand Down
53 changes: 33 additions & 20 deletions autoload/vundle/installer.vim
@@ -1,17 +1,30 @@
" ---------------------------------------------------------------------------
" Try to clone all new bundles given (or all bundles in g:bundles by default)
" to g:bundle_dir. If a:bang is 1 it will also update all plugins (git pull).
" Try to clone all new bundles given (or all bundles in g:vundle#bundles by
" default) to g:vundle#bundle_dir. If a:bang is 1 it will also update all
" plugins (git pull).
"
" bang -- 1 or 0
" ... -- any number of bundle specifications (separate arguments)
" ---------------------------------------------------------------------------
func! vundle#installer#new(bang, ...) abort
let bundles = (a:1 == '') ?
\ g:bundles :
\ map(copy(a:000), 'vundle#config#bundle(v:val, {})')
" No specific plugins are specified. Operate on all plugins.
if a:0 == 0
let bundles = g:vundle#bundles
" Specific plugins are specified for update. Update them.
elseif (a:bang)
let bundles = filter(copy(g:vundle#bundles), 'index(a:000, v:val.name) > -1')
" Specific plugins are specified for installation. Install them.
else
let bundles = map(copy(a:000), 'vundle#config#bundle(v:val, {})')
endif

if empty(bundles)
echoerr 'No bundles were selected for operation'
return
endif

let names = vundle#scripts#bundle_names(map(copy(bundles), 'v:val.name_spec'))
call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:bundle_dir, 1)], names + ['Helptags'])
call vundle#scripts#view('Installer',['" Installing plugins to '.expand(g:vundle#bundle_dir, 1)], names + ['Helptags'])

" This calls 'add' as a normal mode command. This is a buffer local mapping
" defined in vundle#scripts#view(). The mapping will call a buffer local
Expand Down Expand Up @@ -43,11 +56,11 @@ func! s:process(bang, cmd)

exec ':norm '.a:cmd

if 'error' == g:vundle_last_status
if 'error' == s:last_status
let msg = 'With errors; press l to view log'
endif

if 'updated' == g:vundle_last_status && empty(msg)
if 'updated' == s:last_status && empty(msg)
let msg = 'Plugins updated; press u to view changelog'
endif

Expand Down Expand Up @@ -106,7 +119,7 @@ func! vundle#installer#run(func_name, name, ...) abort
throw 'whoops, unknown status:'.status
endif

let g:vundle_last_status = status
let s:last_status = status

return status
endf
Expand Down Expand Up @@ -151,10 +164,10 @@ endf
" return -- the return value from s:sync()
" ---------------------------------------------------------------------------
func! vundle#installer#install(bang, name) abort
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
if !isdirectory(g:vundle#bundle_dir) | call mkdir(g:vundle#bundle_dir, 'p') | endif

let n = substitute(a:name,"['".'"]\+','','g')
let matched = filter(copy(g:bundles), 'v:val.name_spec == n')
let matched = filter(copy(g:vundle#bundles), 'v:val.name_spec == n')

if len(matched) > 0
let b = matched[0]
Expand All @@ -167,12 +180,12 @@ endf


" ---------------------------------------------------------------------------
" Call :helptags for all bundles in g:bundles.
" Call :helptags for all bundles in g:vundle#bundles.
"
" return -- 'error' if an error occurred, else return 'helptags'
" ---------------------------------------------------------------------------
func! vundle#installer#docs() abort
let error_count = vundle#installer#helptags(g:bundles)
let error_count = vundle#installer#helptags(g:vundle#bundles)
if error_count > 0
return 'error'
endif
Expand Down Expand Up @@ -210,10 +223,10 @@ endf
" bang -- not used
" ---------------------------------------------------------------------------
func! vundle#installer#list(bang) abort
let bundles = vundle#scripts#bundle_names(map(copy(g:bundles), 'v:val.name_spec'))
let bundles = vundle#scripts#bundle_names(map(copy(g:vundle#bundles), 'v:val.name_spec'))
call vundle#scripts#view('list', ['" My Plugins'], bundles)
redraw
echo len(g:bundles).' plugins configured'
echo len(g:vundle#bundles).' plugins configured'
endf


Expand All @@ -225,10 +238,10 @@ endf
" should be removed unconditionally
" ---------------------------------------------------------------------------
func! vundle#installer#clean(bang) abort
let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
let bundle_dirs = map(copy(g:vundle#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")
\ ? split(globpath(g:vundle#bundle_dir, '*', 1), "\n")
\ : split(globpath(g:vundle#bundle_dir, '*'), "\n")
let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')

if empty(x_dirs)
Expand Down Expand Up @@ -453,7 +466,7 @@ func! s:sync(bang, bundle) abort
return 'todate'
endif

call add(g:updated_bundles, [initial_sha, updated_sha, a:bundle])
call add(g:vundle#updated_bundles, [initial_sha, updated_sha, a:bundle])
return 'updated'
endf

Expand Down Expand Up @@ -515,7 +528,7 @@ func! s:log(str, ...) abort
let lines = split(a:str, '\n', 1)
let time = strftime(fmt)
for line in lines
call add(g:vundle_log, '['. time .'] '. prefix . line)
call add(g:vundle#log, '['. time .'] '. prefix . line)
endfor
return a:str
endf
Expand Down