#!/usr/bin/env bash # Clone the 6 zsh plugins into config/plugins/. Idempotent and offline-safe: # existing clones are skipped. Pass "update" to git-pull existing ones. # Portable: avoids bash-4 associative arrays (macOS ships bash 3.2). set -euo pipefail DOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" DEST="$DOT/config/plugins"; mkdir -p "$DEST" MODE="${1:-}" # nameurl, one per line. PLUGINS="\ zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting zsh-completions https://github.com/zsh-users/zsh-completions zsh-history-substring-search https://github.com/zsh-users/zsh-history-substring-search fzf-tab https://github.com/Aloxaf/fzf-tab zsh-you-should-use https://github.com/MichaelAquilina/zsh-you-should-use" while read -r name url; do [ -z "$name" ] && continue if [ -d "$DEST/$name/.git" ]; then if [ "$MODE" = "update" ]; then git -C "$DEST/$name" pull --ff-only -q && echo "updated $name" else echo "exists $name" fi else git clone --depth 1 -q "$url" "$DEST/$name" && echo "cloned $name" fi done <