dotfiles/bootstrap.sh
Mats Ricardo Nomedal a11473e308 initial dotfiles
2026-04-23 23:48:01 +02:00

64 lines
2.7 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
DOTFILES="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
link() {
local src="$1" dst="$2"
mkdir -p "$(dirname "$dst")"
ln -sf "$src" "$dst"
echo " linked: $dst"
}
echo "=== Dotfiles Bootstrap (Linux) ==="
# ── Oh My Zsh ─────────────────────────────────────────────────────────────────
if [ ! -d "$HOME/.oh-my-zsh" ]; then
echo "Installing oh-my-zsh..."
RUNZSH=no CHSH=no sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
else
echo "oh-my-zsh already installed, skipping"
fi
# ── Powerlevel10k ─────────────────────────────────────────────────────────────
if [ ! -d "$HOME/.powerlevel10k" ]; then
echo "Cloning powerlevel10k..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$HOME/.powerlevel10k"
else
echo "powerlevel10k already installed, skipping"
fi
# ── Zsh plugins ───────────────────────────────────────────────────────────────
ZSH_CUSTOM="${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"
clone_plugin() {
local name="$1" url="$2"
if [ ! -d "$ZSH_CUSTOM/plugins/$name" ]; then
echo "Cloning plugin: $name"
git clone --depth=1 "$url" "$ZSH_CUSTOM/plugins/$name"
else
echo "Plugin already exists: $name"
fi
}
clone_plugin zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions
clone_plugin zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting
clone_plugin zsh-completions https://github.com/zsh-users/zsh-completions
clone_plugin fast-syntax-highlighting https://github.com/zdharma-continuum/fast-syntax-highlighting
# ── Symlinks ──────────────────────────────────────────────────────────────────
echo "Creating symlinks..."
link "$DOTFILES/zsh/.zshrc" "$HOME/.zshrc"
link "$DOTFILES/zsh/.p10k.zsh" "$HOME/.p10k.zsh"
for theme in "$DOTFILES/zsh/custom/themes"/*.zsh-theme; do
link "$theme" "$ZSH_CUSTOM/themes/$(basename "$theme")"
done
link "$DOTFILES/wezterm/wezterm.lua" "$HOME/.wezterm.lua"
link "$DOTFILES/nvim" "$HOME/.config/nvim"
echo ""
echo "Done! Restart your shell to apply changes."
echo "Neovim plugins will install automatically on first launch of nvim."