Skip to content

Instantly share code, notes, and snippets.

@Shougo
Created July 18, 2011 13:22
Show Gist options
  • Save Shougo/1089495 to your computer and use it in GitHub Desktop.
Save Shougo/1089495 to your computer and use it in GitHub Desktop.
function! s:BundleGet() "{{{
let bundle_dir = expand('~/.vim/bundle')
try
let org_cwd = getcwd()
silent lcd `=bundle_dir`
let repo = matchstr(getline('.'), 'BUNDLE:\s\+\zs.*')
if repo != ''
let local_name = substitute(fnamemodify(repo, ':t'),
\ '^\%\(vim-\)\?\(.*\).git','\1', '')
if isdirectory(local_name)
let cmd = 'cd ' . local_name
echo cmd
lcd `=local_name`
let cmd = 'git pull'
echo cmd
let output = vimproc#system(cmd)
echo output
else
let cmd = 'git clone ' . repo . ' ' . local_name
echo cmd
let output = vimproc#system(cmd)
echo output
endif
endif
finally
silent lcd `=org_cwd`
endtry
endfunction"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment