#!/bin/sh

set -e

if [ -d "$HOME/.config/nvim" ]; then
  echo "[INFO] existing nvim config found, skipping distro bootstrap"
  exit 0
fi

case "$NVIM_DISTRO" in
  lazyvim)
    echo "[INFO] bootstrapping LazyVim"
    git clone https://github.com/LazyVim/starter "$HOME/.config/nvim"
    ;;
  astrovim)
    echo "[INFO] bootstrapping AstroVim"
    git clone https://github.com/AstroNvim/template "$HOME/.config/nvim"
    ;;
  nvchad)
    echo "[INFO] bootstrapping NvChad"
    git clone https://github.com/NvChad/starter "$HOME/.config/nvim"
    ;;
  kickstart)
    echo "[INFO] bootstrapping kickstart.nvim"
    git clone https://github.com/nvim-lua/kickstart.nvim "$HOME/.config/nvim"
    ;;
  *)
    echo "[WARN] unknown NVIM_DISTRO: $NVIM_DISTRO"
    exit 0
    ;;
esac

rm -rf "$HOME/.config/nvim/.git"
echo "[INFO] $NVIM_DISTRO bootstrapped to $HOME/.config/nvim"
