vim-scripts.zsh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/zsh
  2. #
  3. # Vim scripts updates
  4. #
  5. set -A vim_scripts \
  6. "https://github.com/Jonty/phplint.vim/raw/master/phplint.vim" \
  7. "http://git.openics.org/cgit.cgi/bindzoneedit.vim/plain/bindzoneedit.vim"
  8. vim_scripts_update() {
  9. local ret=0
  10. if which wget &>/dev/null; then
  11. for i in {1..${#vim_scripts}} ; do
  12. local script=$vim_scripts[$i]
  13. local script_name=$(basename "$script")
  14. local script_path=${HOME}/.vim/plugin/${script_name}
  15. local script_path_temp=${script_path}.new
  16. echo -n "Upgrading “${script_name}” from $script ... "
  17. echo "\"" > "${script_path_temp}"
  18. echo "\" script downloaded from ${script}" >> "${script_path_temp}"
  19. echo "\"" >> "${script_path_temp}"
  20. echo "" >> "${script_path_temp}"
  21. wget --no-check-certificate -q "$script" -O - >> "${script_path_temp}"
  22. if [ $? = 0 ]; then
  23. if [ -r "${script_path}" ]; then
  24. rm -f "${script_path}"
  25. fi
  26. mv "${script_path_temp}" "${script_path}"
  27. echo "done"
  28. else
  29. echo "fail"
  30. ret=1
  31. fi
  32. rm -f "${script_path_temp}"
  33. done
  34. else
  35. echo "Can't find “wget” (not in path or installed?)."
  36. ret=1
  37. fi
  38. return ret
  39. }