Files
omarchy-pkgs/pkgbuilds/omarchy-lazyvim/omarchy-lazyvim-setup
T
2025-10-08 11:11:54 -04:00

54 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Setup script for omarchy-lazyvim
# This can be called from Omarchy setup scripts
set -euo pipefail
PACKAGE_DIR="/usr/share/omarchy-lazyvim"
CONFIG_DIR="${HOME}/.config/nvim"
DATA_DIR="${HOME}/.local/share/nvim"
STATE_DIR="${HOME}/.local/state/nvim"
CACHE_DIR="${HOME}/.cache/nvim"
# Check if package is installed
if [[ ! -d "$PACKAGE_DIR" ]]; then
echo "Error: omarchy-lazyvim package not installed"
exit 1
fi
# Check if nvim config already exists
if [[ -d "$CONFIG_DIR" ]]; then
if gum confirm "Neovim configuration already exists at $CONFIG_DIR. This will overwrite it. Continue?"; then
# Backup existing config
BACKUP_DIR="${CONFIG_DIR}.backup.$(date +%Y%m%d-%H%M%S)"
echo "Backing up existing config to $BACKUP_DIR"
mv "$CONFIG_DIR" "$BACKUP_DIR"
else
echo "Setup cancelled."
exit 0
fi
fi
echo "Setting up LazyVim configuration..."
# Make sure everything is clear
rm -rf $DATA_DIR $CACHE_DIR $STATE_DIR
# Create directories if needed
mkdir -p "$(dirname "$CONFIG_DIR")"
mkdir -p "$(dirname "$DATA_DIR")"
mkdir -p "$(dirname "$CACHE_DIR")"
# Copy files
cp -r "$PACKAGE_DIR/config" "$CONFIG_DIR"
cp -r "$PACKAGE_DIR/data" "$DATA_DIR"
cp -r "$PACKAGE_DIR/cache" "$CACHE_DIR"
for dir in $DATA_DIR/lazy/*/; do
if [ -d "$dir/.git" ]; then
git --git-dir="$dir/.git" --work-tree="$dir" restore .
fi
done
echo "LazyVim setup complete!"