#!/bin/bash set -euo pipefail echo "============================================" echo "NvChad Configuration Installation Script" echo "============================================" echo "" echo "This script will:" echo " - Backup existing ~/.config/nvim to ~/.config/nvim.backup (if exists)" echo " - Clone your NvChad config from git@gitea.hptrow.me:pt/nvchad.git (customize branch)" echo " - Launch nvim to auto-install lazy.nvim and all plugins" echo "" echo "Prerequisites:" echo " - Neovim 0.9.5+ must be installed (run ./install_neovim.sh if needed)" echo " - Git must be installed" echo " - SSH key must be set up for gitea.hptrow.me" echo "" read -p "Continue with installation? (y/N) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then echo "Installation cancelled." exit 0 fi echo "" echo "Starting installation..." echo "" # Check prerequisites if ! command -v nvim &> /dev/null; then echo "Error: Neovim is not installed or not in PATH" >&2 echo "Please run ./install_neovim.sh first" >&2 exit 1 fi if ! command -v git &> /dev/null; then echo "Error: Git is not installed" >&2 exit 1 fi # Verify Neovim version NVIM_VERSION=$(nvim --version | head -n1 | grep -oP 'v\K[0-9]+\.[0-9]+' || echo "0.0") REQUIRED_VERSION="0.9" if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$NVIM_VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]; then echo "Error: Neovim version $NVIM_VERSION is too old (need 0.9.5+)" >&2 exit 1 fi echo "Neovim version: $(nvim --version | head -n1)" echo "" # Backup existing config if it exists if [ -d ~/.config/nvim ]; then echo "Backing up existing ~/.config/nvim to ~/.config/nvim.backup" if [ -d ~/.config/nvim.backup ]; then rm -rf ~/.config/nvim.backup fi mv ~/.config/nvim ~/.config/nvim.backup fi # Clone the config echo "Cloning NvChad config from gitea (customize branch)..." set -x git clone -b customize git@gitea.hptrow.me:pt/nvchad.git ~/.config/nvim set +x if [ ! -d ~/.config/nvim ]; then echo "Error: Failed to clone config" >&2 exit 1 fi echo "" echo "Config cloned successfully!" echo "" echo "============================================" echo "First Launch Setup" echo "============================================" echo "" echo "Neovim will now launch and automatically:" echo " 1. Bootstrap lazy.nvim plugin manager" echo " 2. Install NvChad (as a plugin)" echo " 3. Install all configured plugins" echo "" echo "This may take a few minutes on first run." echo "After installation completes, close nvim with :q" echo "" read -p "Press Enter to launch nvim and complete setup..." -r echo "" # Launch nvim to trigger plugin installation nvim +q echo "" echo "============================================" echo "Installation Complete!" echo "============================================" echo "" echo "Your NvChad configuration is installed at: ~/.config/nvim" echo "" echo "Key customizations in this config:" echo " - Theme: vscode_dark" echo " - Tab width: 4 spaces" echo " - Obsidian.nvim integration" echo " - SQL development tools (pg_format, sqlfluff)" echo " - Mason for installing formatters" echo " - Custom keybindings: g+w (format), gb (blame), more in lua/mappings.lua" echo "" echo "Next time you launch nvim, everything will be ready!" echo "" if [ -d ~/.config/nvim.backup ]; then echo "Note: Your old config was backed up to ~/.config/nvim.backup" fi echo "============================================"