Guest User

Untitled

a guest
Feb 18th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. func! s:sync(bang, bundle) abort
  2. let git_dir = expand(a:bundle.path().'/.git/')
  3. if isdirectory(git_dir)
  4. if !(a:bang) | return 0 | endif
  5. let cmd = 'git pull'
  6. if (has('win32') || has('win64'))
  7. "let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
  8. let cmd = '"'.cmd.'"' " enclose in quotes
  9. endif
  10. "cd to bundle path"
  11. cd `=a:bundle.path()`
  12. let l:result = s:system(cmd)
  13. if l:result =~ "^Already up-to-date."
  14. return 0
  15. else
  16. return 1
  17. endif
  18. else
  19. let cmd = 'git clone '.a:bundle.uri.' '.a:bundle.path()
  20. call s:system(cmd)
  21. return 1
  22. endif
  23. endf
Add Comment
Please, Sign In to add comment