diff update-vendor @ 704:1e0f578f6752

Update vendor and add support for vim packs
author nanaya <me@nanaya.net>
date Sun, 18 Dec 2022 20:06:46 +0900
parents 17cacf387f7c
children 4b30df382167
line wrap: on
line diff
--- a/update-vendor	Sun Dec 18 19:29:43 2022 +0900
+++ b/update-vendor	Sun Dec 18 20:06:46 2022 +0900
@@ -4,12 +4,13 @@
 set -e
 
 
-if command -v wget > /dev/null 2>&1; then :
-else
-  echo wget is required
-  exit 1
-fi
-
+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() {
   (
@@ -20,15 +21,28 @@
   )
 }
 
+_get_pack_github() {
+  (
+    mkdir -p "$1" && cd "$1"
+    wget -nv -O - "$2" | unzip -q -
+    # hopefully only one directory inside
+    _dirname="$(echo *)"
+    mv "./${_dirname}"/* ./
+    mv "./${_dirname}"/.??* ./
+    rmdir "./${_dirname}"
+  )
+}
 
+_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"
 
@@ -48,12 +62,29 @@
   _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/srcery-colors/srcery-vim/master/colors/srcery.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" "https://github.com/srcery-colors/srcery-vim/archive/refs/heads/master.zip"
+)
+}
+
+_autoloads
+_syntaxes
+_colors
+_packs