this repo has no description
at main 2.2 kB view raw
1#!/usr/bin/env bash 2 3set -euo pipefail 4 5DOTFILES_DIR="$HOME/dotfiles" 6 7function link_configs { 8 echo "Linking configuration files..." 9 10 declare -A mappings 11 12 # TODO: Make this linux compatible 13 mappings["ghostty"]="$HOME/Library/Application Support/com.mitchellh.ghostty" 14 mappings["zsh/zshenv"]="$HOME/.zshenv" 15 mappings["zsh/zshrc"]="$HOME/.zshrc" 16 mappings["misc/tmux.conf"]="$HOME/.tmux.conf" 17 mappings["git/gitconfig"]="$HOME/.gitconfig" 18 mappings["git/gitignore"]="$HOME/.gitignore" 19 mappings["misc/vimrc"]="$HOME/.vimrc" 20 mappings["nvim"]="$HOME/.config/nvim" 21 mappings["glide"]="$HOME/.config/glide" 22 mappings["misc/global-tool-versions"]="$HOME/.tool-versions" 23 mappings["ai/skills"]="$HOME/.claude/skills" 24 mappings["hammerspoon"]="$HOME/.hammerspoon" 25 mappings["zsh/starship.toml"]="$HOME/.config/starship.toml" 26 27 for key in "${!mappings[@]}"; do 28 source="${key}" 29 destination="${mappings[$key]}" 30 31 if [ -d "$source" ]; then 32 mkdir -p "$(dirname "$destination")" 33 create_symlink "$source" "$destination" 34 elif [ -f "$source" ]; then 35 create_symlink "$source" "$destination" 36 else 37 echo "Warning: Source $source does not exist, skipping." 38 fi 39 done 40} 41 42function create_symlink { 43 local source="$1" 44 local destination="$2" 45 46 echo "$source -> $destination" 47 48 if [ -L "$destination" ]; then 49 if [ "$(readlink "$destination")" = "$DOTFILES_DIR/$source" ]; then 50 echo " Already established" 51 return 52 else 53 echo " Removing existing symlink ($(readlink "$destination"))" 54 rm "$destination" 55 fi 56 fi 57 58 if [ -e "$destination" ]; then 59 echo " Destination exists, backing it up" 60 mv "$destination" "${destination}.bak" 61 fi 62 63 echo " Creating symlink" 64 ln -s "$DOTFILES_DIR/$source" "$destination" 65} 66 67function install_oh_my_zsh { 68 if [ -d "$HOME/.oh-my-zsh" ]; then 69 echo "Oh My Zsh is already installed." 70 return 71 fi 72 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended 73} 74 75function install_tpm { 76 if [ -d "$HOME/.tmux/plugins/tpm" ]; then 77 echo "TPM is already installed." 78 return 79 fi 80 git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 81} 82 83link_configs 84install_oh_my_zsh 85install_tpm