windows support

This commit is contained in:
gmarik 2011-04-09 18:54:18 -05:00
parent 2624232f73
commit 61bfc5ab9f
4 changed files with 25 additions and 25 deletions

View File

@ -11,7 +11,7 @@ func! vundle#config#init()
let g:bundles = [] let g:bundles = []
endf endf
func! vundle#config#require(bundles) func! vundle#config#require(bundles) abort
for b in a:bundles for b in a:bundles
call s:rtp_add(b.rtpath()) call s:rtp_add(b.rtpath())
call s:rtp_add(g:bundle_dir) call s:rtp_add(g:bundle_dir)
@ -64,14 +64,14 @@ func! s:rtp_add_a()
call filter(reverse(copy(g:bundles)), 's:rtp_add(v:val.rtpath())') call filter(reverse(copy(g:bundles)), 's:rtp_add(v:val.rtpath())')
endf endf
func! s:rtp_rm(dir) func! s:rtp_rm(dir) abort
exec 'set rtp-='.a:dir exec 'set rtp-='.escape(expand(a:dir),' ')
exec 'set rtp-='.expand(a:dir.'/after') exec 'set rtp-='.escape(expand(a:dir.'/after'), ' ')
endf endf
func! s:rtp_add(dir) func! s:rtp_add(dir) abort
exec 'set rtp^='.a:dir exec 'set rtp^='.escape(expand(a:dir), ' ')
exec 'set rtp+='.expand(a:dir.'/after') exec 'set rtp+='.escape(expand(a:dir.'/after'), ' ')
endf endf
let s:bundle = {} let s:bundle = {}

View File

@ -1,4 +1,4 @@
func! vundle#installer#install(bang, ...) func! vundle#installer#install(bang, ...) abort
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
let bundles = (a:1 == '') ? let bundles = (a:1 == '') ?
\ s:reload_bundles() : \ s:reload_bundles() :
@ -11,19 +11,19 @@ func! vundle#installer#install(bang, ...)
call s:log("Installed bundles:\n".join((empty(installed) ? ['no new bundless installed'] : map(installed, 'v:val.name')),"\n")) call s:log("Installed bundles:\n".join((empty(installed) ? ['no new bundless installed'] : map(installed, 'v:val.name')),"\n"))
let help_dirs = vundle#installer#helptags(bundles) let help_dirs = vundle#installer#helptags(bundles)
if !empty(help_dirs)
call s:log('Helptags: done. '.len(help_dirs).' bundles processed')
endif
endf endf
func! vundle#installer#helptags(bundles) func! vundle#installer#helptags(bundles) abort
let bundle_dirs = map(copy(a:bundles),'v:val.rtpath()') let bundle_dirs = map(copy(a:bundles),'v:val.rtpath()')
let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)') let help_dirs = filter(bundle_dirs, 's:has_doc(v:val)')
call map(copy(help_dirs), 's:helptags(v:val)') call map(copy(help_dirs), 's:helptags(v:val)')
if !empty(help_dirs)
call s:log('Helptags: done. '.len(help_dirs).' bundles processed')
endif
return help_dirs return help_dirs
endf endf
func! vundle#installer#clean(bang) func! vundle#installer#clean(bang) abort
let bundle_dirs = map(copy(g:bundles), 'v:val.path()') let bundle_dirs = map(copy(g:bundles), 'v:val.path()')
let all_dirs = split(globpath(g:bundle_dir, '*'), "\n") let all_dirs = split(globpath(g:bundle_dir, '*'), "\n")
let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)')
@ -46,29 +46,29 @@ func! s:reload_bundles()
return g:bundles return g:bundles
endf endf
func! s:has_doc(rtp) func! s:has_doc(rtp) abort
return isdirectory(a:rtp.'/doc') return isdirectory(a:rtp.'/doc')
\ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags')) \ && (!filereadable(a:rtp.'/doc/tags') || filewritable(a:rtp.'/doc/tags'))
\ && !(empty(glob(a:rtp.'/doc/*.txt')) && empty(glob(a:rtp.'/doc/*.??x'))) \ && !(empty(glob(a:rtp.'/doc/*.txt')) && empty(glob(a:rtp.'/doc/*.??x')))
endf endf
func! s:helptags(rtp) func! s:helptags(rtp) abort
helptags `=a:rtp.'/doc'` helptags `=a:rtp.'/doc'`
endf endf
func! s:sync(bang, bundle) abort func! s:sync(bang, bundle) abort
let git_dir = a:bundle.path().'/.git' let git_dir = shellescape(expand(a:bundle.path().'/.git'))
if isdirectory(git_dir) if isdirectory(git_dir)
if !(a:bang) | return 0 | endif if !(a:bang) | return 0 | endif
let cmd = 'cd '.a:bundle.path().' && git pull' let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull'
else else
let cmd = 'git clone '.a:bundle.uri.' '.a:bundle.path() let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path())
endif endif
silent exec '!'.cmd silent exec '!'.cmd
return 1 return 1
endf endf
func! s:install(bang, bundles) func! s:install(bang, bundles) abort
return filter(copy(a:bundles), 's:sync(a:bang, v:val)') return filter(copy(a:bundles), 's:sync(a:bang, v:val)')
endf endf

View File

@ -39,22 +39,24 @@ func! s:display(headers, results)
let results = reverse(map(a:results, ' printf("Bundle ' ."'%s'".'", v:val) ')) let results = reverse(map(a:results, ' printf("Bundle ' ."'%s'".'", v:val) '))
call writefile(a:headers + results, s:browse) call writefile(a:headers + results, s:browse)
silent pedit `=s:browse` silent pedit `=s:browse`
wincmd P | wincmd H wincmd P | wincmd H
setl ft=vundle setl ft=vundle
endf endf
func! s:fetch_scripts(to) func! s:fetch_scripts(to)
let temp = tempname() let temp = shellescape(tempname())
if has('win32') || has('win64') if has('win32') || has('win64')
let scripts_dir = fnamemodify(expand(a:to), ":h") let scripts_dir = fnamemodify(expand(a:to), ":h")
if !isdirectory(scripts_dir) if !isdirectory(scripts_dir)
call mkdir(scripts_dir, "p") call mkdir(scripts_dir, "p")
endif endif
exec '!curl http://vim-scripts.org/api/scripts.json > '.temp. exec '!curl http://vim-scripts.org/api/scripts.json > '.temp.
\ '&& move /Y '.temp.' '.a:to \ '&& move /Y '.temp.' '.shellescape(a:to)
else else
exec '!curl http://vim-scripts.org/api/scripts.json > '.temp. exec '!curl http://vim-scripts.org/api/scripts.json > '.temp.
\ '&& mkdir -p $(dirname '.a:to.') && mv -f '.temp.' '.a:to \ '&& mkdir -p $(dirname '.shellescape(a:to).') && mv -f '.temp.' '.shellescape(a:to)
endif endif
endf endf

View File

@ -1,6 +1,4 @@
setl hls ro noma ignorecase setl hls ro noma ignorecase syntax=vim
set syntax=vim
syn keyword vimCommand Bundle syn keyword vimCommand Bundle