Cleanup
This commit is contained in:
parent
5632996548
commit
ef641633b5
@ -1,5 +1,5 @@
|
||||
func! vundle#scripts#search(bang,search_str)
|
||||
let matches = filter(eval(vundle#scripts#read(a:bang)), 'v:val =~ "'.escape(a:search_str,'"').'"')
|
||||
let matches = filter(s:load_scripts(a:bang), 'v:val =~ "'.escape(a:search_str,'"').'"')
|
||||
let results = map(matches, ' printf("Bundle \"%s\"", v:val) ')
|
||||
call s:display(results, a:search_str)
|
||||
endf
|
||||
@ -16,16 +16,16 @@ func! s:display(results,search_str)
|
||||
redraw
|
||||
endf
|
||||
|
||||
func! vundle#scripts#fetch(to)
|
||||
func! s:fetch_scripts(to)
|
||||
let temp = tempname()
|
||||
exec '!curl http://vim-scripts.org/api/scripts.json > '.temp
|
||||
exec '!mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to
|
||||
endf
|
||||
|
||||
func! vundle#scripts#read(bang)
|
||||
let scripts_file = expand('$HOME/.vim-vundle/vim-scripts.org.json')
|
||||
if '!' == a:bang || !filereadable(scripts_file)
|
||||
call vundle#scripts#fetch(scripts_file)
|
||||
func! s:load_scripts(bang)
|
||||
let f = expand('$HOME/.vim-vundle/vim-scripts.org.json')
|
||||
if '!' == a:bang || !filereadable(f)
|
||||
call s:fetch_scripts(f)
|
||||
endif
|
||||
return readfile(scripts_file, 'b')[0]
|
||||
return eval(readfile(f, 'b')[0])
|
||||
endf
|
||||
|
Loading…
Reference in New Issue
Block a user