view update-vendor @ 706:4b30df382167

[update-vendor] smarter pack handling?
author nanaya <me@nanaya.net>
date Sun, 18 Dec 2022 22:23:22 +0900
parents 1e0f578f6752
children 4576f1471f53
line wrap: on
line source

#!/bin/sh

set -u
set -e


for _cmd in wget unzip; do
  if command -v "$_cmd" > /dev/null 2>&1; then :
  else
    echo "${_cmd} is required"
    exit 1
  fi
done

_get() {
  (
      if [ -n "${2:-}" ]; then
        mkdir -p "$2" && cd "$2"
      fi
      wget -nv "$1"
  )
}

_get_pack_github() {
  (
    wget -nv -O - "$3" | unzip -q -
    mv "./${1}-${2}" "./${1}"
  )
}

_autoloads() {
(
  cd "$(dirname "$0")/vendor/vim-autoload"

  rm -f ./*.vim ./*/*.vim
  _get "https://raw.githubusercontent.com/tpope/vim-pathogen/master/autoload/pathogen.vim"
)
}

_syntaxes() {
(
  cd "$(dirname "$0")/vendor/vim-syntax"

  rm -f ./*.vim ./*/*.vim
  _get https://hg.nginx.org/nginx/raw-file/tip/contrib/vim/syntax/nginx.vim
  _get https://raw.githubusercontent.com/jwalton512/vim-blade/master/syntax/blade.vim
  _get https://raw.githubusercontent.com/kchmck/vim-coffee-script/master/syntax/coffee.vim
  _get https://raw.githubusercontent.com/slim-template/vim-slim/master/syntax/slim.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/css.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/eruby.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/javascript.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/json.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/less.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/ruby.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/scss.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/typescript.vim
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/shared/typescriptcommon.vim shared
  _get https://raw.githubusercontent.com/vim/vim/master/runtime/syntax/typescriptreact.vim
)
}

_colors() {
(
  cd "$(dirname "$0")/vendor/vim-colors"

  rm -f ./*.vim ./*/*.vim
  _get https://raw.githubusercontent.com/NLKNguyen/papercolor-theme/master/colors/PaperColor.vim
  _get https://raw.githubusercontent.com/tomasiser/vim-code-dark/master/colors/codedark.vim
)
}

_packs() {
(
  cd "$(dirname "$0")/vendor/vim-packs"

  touch empty
  rm -rf ./*
  _get_pack_github "srcery-vim" "master" "https://github.com/srcery-colors/srcery-vim/archive/refs/heads/master.zip"
)
}

_autoloads
_syntaxes
_colors
_packs