Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func! s:sync(bang, bundle) abort
- let git_dir = expand(a:bundle.path().'/.git/')
- if isdirectory(git_dir)
- if !(a:bang) | return 0 | endif
- let cmd = 'git pull'
- if (has('win32') || has('win64'))
- "let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
- let cmd = '"'.cmd.'"' " enclose in quotes
- endif
- "cd to bundle path"
- cd `=a:bundle.path()`
- let l:result = s:system(cmd)
- if l:result =~ "^Already up-to-date."
- return 0
- else
- return 1
- endif
- else
- let cmd = 'git clone '.a:bundle.uri.' '.a:bundle.path()
- call s:system(cmd)
- return 1
- endif
- endf
Add Comment
Please, Sign In to add comment