#!/usr/bin/env bash # # Neovim Installer Script # # Run metascript to check if the shell is bash and load libraries PARENT_DIR="$(dirname "$0")/.." METASCRIPT_LOCAL="$PARENT_DIR/bootstrap.sh" METASCRIPT_URL="https://git.adityagupta.dev/sortedcord/bootstrap/raw/branch/master/bootstrap.sh" if [ -f "$METASCRIPT_LOCAL" ]; then . "$METASCRIPT_LOCAL" else if command -v wget >/dev/null 2>&1; then eval "$(wget -qO- "$METASCRIPT_URL")" elif command -v curl >/dev/null 2>&1; then eval "$(curl -fsSL "$METASCRIPT_URL")" else echo "Error: Neither wget nor curl is installed to fetch bootstrap.sh." >&2 exit 1 fi fi set -euo pipefail NVIM_VERSION="0.11.7" NVIM_INSTALL_DIR="/opt/nvim" NVIM_CONFIG_REPO="https://git.adityagupta.dev/sortedcord/editor.git" NVIM_CONFIG_DIR="$HOME/.config/nvim" TMP_DIR="$(make_temp_dir)" cleanup() { rm -rf "$TMP_DIR" } trap cleanup EXIT check_config_dir() { if [[ -d "$NVIM_CONFIG_DIR" ]]; then if confirm "$NVIM_CONFIG_DIR already exists. Replace it?"; then log_info "Existing configuration will be removed during setup." rm -rf "$NVIM_CONFIG_DIR" else while true; do read -r -p "Enter an alternative directory to clone the configuration into: " alt_dir /dev/null || true fi done } main() { check_config_dir install_packages install_nvim install_config configure_shell echo log_success "Installation complete." } main "$@"