dotfiles-rene/nvim/install-nvim-dotfiles.sh

78 lines
2.1 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Neovim Dotfiles Installer
# Erstellt Symlink und installiert Abhängigkeiten
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NVIM_CONFIG="$HOME/.config/nvim"
echo "=== Neovim Dotfiles Installer ==="
# Prüfe ob Neovim installiert ist
if ! command -v nvim &> /dev/null; then
echo "Neovim nicht gefunden!"
echo "Installation:"
echo " macOS: brew install neovim"
echo " Debian: sudo apt install neovim"
exit 1
fi
# Backup falls Config existiert
if [ -e "$NVIM_CONFIG" ] && [ ! -L "$NVIM_CONFIG" ]; then
echo "Bestehende Config gefunden, erstelle Backup..."
mv "$NVIM_CONFIG" "$NVIM_CONFIG.bak.$(date +%Y%m%d%H%M%S)"
fi
# Entferne alten Symlink falls vorhanden
if [ -L "$NVIM_CONFIG" ]; then
echo "Entferne alten Symlink..."
rm "$NVIM_CONFIG"
fi
# Erstelle .config falls nicht vorhanden
mkdir -p "$HOME/.config"
# Symlink erstellen
echo "Erstelle Symlink: $NVIM_CONFIG -> $SCRIPT_DIR"
ln -s "$SCRIPT_DIR" "$NVIM_CONFIG"
# Abhängigkeiten prüfen/installieren
echo ""
echo "=== Empfohlene Abhängigkeiten ==="
if command -v brew &> /dev/null; then
# macOS
echo "macOS erkannt, prüfe Homebrew-Pakete..."
PACKAGES="ripgrep fd node"
for pkg in $PACKAGES; do
if ! brew list $pkg &> /dev/null; then
echo "Installiere $pkg..."
brew install $pkg
else
echo "$pkg bereits installiert"
fi
done
elif command -v apt &> /dev/null; then
# Debian/Ubuntu
echo "Debian/Ubuntu erkannt"
echo "Empfohlene Pakete: ripgrep fd-find nodejs npm"
echo " sudo apt install ripgrep fd-find nodejs npm"
fi
echo ""
echo "=== Installation abgeschlossen ==="
echo "Starte nvim Plugins werden automatisch installiert."
echo ""
echo "Shortcuts:"
echo " Space + e Dateibaum"
echo " Space + ff Dateien suchen"
echo " Space + fg Text suchen"
echo " Space + pb PlatformIO Build"
echo " Space + pu PlatformIO Upload"
echo " Space + pm Serial Monitor"
echo " Ctrl + t Terminal toggle"
echo " gd Gehe zur Definition"
echo " K Hover/Dokumentation"