Cleanup
This commit is contained in:
parent
e7995e04d5
commit
7f7b3f1097
@ -7,7 +7,7 @@ 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()
|
||||||
|
|
||||||
com! -nargs=* BundleSearch call vundle#scripts#search(<q-args>)
|
com! -nargs=* BundleSearch silent call vundle#scripts#search(<q-args>)
|
||||||
|
|
||||||
func! vundle#rc()
|
func! vundle#rc()
|
||||||
let g:bundle_dir = expand('$HOME/.vim/bundle/')
|
let g:bundle_dir = expand('$HOME/.vim/bundle/')
|
||||||
@ -25,10 +25,7 @@ endf
|
|||||||
|
|
||||||
func! vundle#init_bundle(arg, opts)
|
func! vundle#init_bundle(arg, opts)
|
||||||
let bundle = a:opts | let arg = a:arg
|
let bundle = a:opts | let arg = a:arg
|
||||||
if arg =~ '^\s*\d\+\s*$' || type(arg) == type(42) " script id
|
if arg =~ '^\s*\(git@\|git://\)\S\+' || arg =~ 'https\?://' || arg =~ '\.git\*$'
|
||||||
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.uri = arg
|
||||||
let bundle.name = substitute(split(bundle.uri,'\/')[-1], '\.git\s*$','','i')
|
let bundle.name = substitute(split(bundle.uri,'\/')[-1], '\.git\s*$','','i')
|
||||||
else
|
else
|
||||||
|
@ -1,40 +1,24 @@
|
|||||||
func! vundle#scripts#search(...)
|
func! vundle#scripts#search(...)
|
||||||
let matches = map(vundle#scripts#lookup(a:1), ' printf("Bundle \"%s\"", v:val) ')
|
let matches = filter(eval(vundle#scripts#read()), 'v:val =~ "'.escape(a:1,'"').'"')
|
||||||
|
let results = map(matches, ' printf("Bundle \"%s\"", v:val) ')
|
||||||
let temp = tempname()
|
let temp = tempname()
|
||||||
call writefile(matches, temp)
|
call writefile(results, temp)
|
||||||
exec 'sp '.temp
|
exec 'sp '.temp
|
||||||
let @/=a:1
|
let @/=a:1
|
||||||
setlocal hls ft=vim
|
setlocal hls ft=vim
|
||||||
redraw
|
redraw
|
||||||
endf
|
endf
|
||||||
|
|
||||||
func! vundle#scripts#lookup(term)
|
func! vundle#scripts#fetch(to)
|
||||||
return filter(vundle#scripts#load(), 'v:val =~ "'.escape(a:term,'"').'"')
|
|
||||||
endf
|
|
||||||
|
|
||||||
func! vundle#scripts#fetch()
|
|
||||||
let to = g:vundle_scripts_file
|
|
||||||
let temp = tempname()
|
let temp = tempname()
|
||||||
exec '!curl http://vim-scripts.org/api/scripts.json > '.temp
|
exec '!curl http://vim-scripts.org/api/scripts.json > '.temp
|
||||||
exec '!mkdir -p $(dirname '.to.') && mv -f '.temp.' '.to
|
exec '!mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to
|
||||||
return to
|
|
||||||
endf
|
endf
|
||||||
|
|
||||||
func! vundle#scripts#read()
|
func! vundle#scripts#read()
|
||||||
if !filereadable(g:vundle_scripts_file)
|
let scripts_file = expand('$HOME/.vim-vundle/vim-scripts.org.json')
|
||||||
call vundle#scripts#fetch()
|
if !filereadable(scripts_file)
|
||||||
|
call vundle#scripts#fetch(scripts_file)
|
||||||
endif
|
endif
|
||||||
return readfile(g:vundle_scripts_file, 'b')[0]
|
return readfile(scripts_file, 'b')[0]
|
||||||
endf
|
|
||||||
|
|
||||||
func! vundle#scripts#load()
|
|
||||||
let g:vundle_scripts_file = expand('$HOME/.vim-vundle/vim-scripts.org.json')
|
|
||||||
let g:vundle_scripts = eval(vundle#scripts#read())
|
|
||||||
|
|
||||||
return g:vundle_scripts
|
|
||||||
endf
|
|
||||||
|
|
||||||
func! vundle#scripts#find(id)
|
|
||||||
let scripts = vundle#scripts#load()
|
|
||||||
return scripts[a:id]
|
|
||||||
endf
|
endf
|
||||||
|
Loading…
Reference in New Issue
Block a user