-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·168 lines (140 loc) · 6.79 KB
/
setup.sh
File metadata and controls
executable file
·168 lines (140 loc) · 6.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/bash
set -e
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "════════════════════════════════════════════════════════════"
echo " Dotfiles Setup"
echo "════════════════════════════════════════════════════════════"
# ─────────────────────────────────────────────────────────────
# Install Homebrew if not present
# ─────────────────────────────────────────────────────────────
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add brew to path for Apple Silicon
if [[ $(uname -m) == "arm64" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
fi
# ─────────────────────────────────────────────────────────────
# Install oh-my-zsh if not present
# ─────────────────────────────────────────────────────────────
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
echo "Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
# ─────────────────────────────────────────────────────────────
# Install dependencies
# ─────────────────────────────────────────────────────────────
echo "Installing dependencies..."
brew install neovim
brew install tmux
brew install zsh-autosuggestions
brew install zsh-syntax-highlighting
brew install fzf
brew install eza
brew install nvm
brew install ripgrep
brew install go
brew install zoxide
brew install terminal-notifier
# Install Node via nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && \. "$(brew --prefix)/opt/nvm/nvm.sh"
nvm install --lts
nvm use --lts
# Install language servers
go install golang.org/x/tools/gopls@latest
npm install -g typescript typescript-language-server
# Set up fzf key bindings
yes | $(brew --prefix)/opt/fzf/install --key-bindings --completion --no-bash --no-fish --no-update-rc
# Install TPM (tmux plugin manager)
if [[ ! -d "$HOME/.tmux/plugins/tpm" ]]; then
echo "Installing TPM..."
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
# Install tmux plugins via TPM
echo "Installing tmux plugins..."
tmux start-server \; source-file ~/.tmux.conf && ~/.tmux/plugins/tpm/bin/install_plugins
# Install Nerd Font
echo "Installing Nerd Font..."
brew install --cask font-jetbrains-mono-nerd-font
# ─────────────────────────────────────────────────────────────
# Create symlinks
# ─────────────────────────────────────────────────────────────
echo "Creating symlinks..."
# Create symlink if it doesn't exist or points elsewhere
link_file() {
local src="$1"
local dest="$2"
# Already correctly linked
if [[ -L "$dest" && "$(readlink "$dest")" == "$src" ]]; then
echo " $dest already linked"
return
fi
# Backup if regular file exists
if [[ -e "$dest" && ! -L "$dest" ]]; then
echo " Backing up $dest to $dest.backup"
mv "$dest" "$dest.backup"
elif [[ -L "$dest" ]]; then
rm "$dest"
fi
ln -s "$src" "$dest"
echo " Linked $dest"
}
# zsh
link_file "$DOTFILES_DIR/.zshrc" ~/.zshrc
# bash (for Claude Code and other non-zsh shells)
link_file "$DOTFILES_DIR/.bash_profile" ~/.bash_profile
# tmux
link_file "$DOTFILES_DIR/.tmux.conf" ~/.tmux.conf
# ghostty
mkdir -p ~/.config/ghostty
link_file "$DOTFILES_DIR/ghostty/config" ~/.config/ghostty/config
# neovim
mkdir -p ~/.config
link_file "$DOTFILES_DIR/nvim" ~/.config/nvim
# claude code
mkdir -p ~/.claude/scripts
link_file "$DOTFILES_DIR/claude/scripts/notify-waiting.sh" ~/.claude/scripts/notify-waiting.sh
link_file "$DOTFILES_DIR/claude/scripts/notify-done.sh" ~/.claude/scripts/notify-done.sh
# claude code global CLAUDE.md
link_file "$DOTFILES_DIR/claude/global-CLAUDE.md" ~/.claude/CLAUDE.md
# claude code commands
mkdir -p ~/.claude/commands
for cmd in "$DOTFILES_DIR/claude/commands"/*.md; do
[ -f "$cmd" ] && link_file "$cmd" ~/.claude/commands/$(basename "$cmd")
done
# Copy settings.json (not symlinked - Claude Code adds runtime state to it)
if [[ ! -f ~/.claude/settings.json ]] || [[ -L ~/.claude/settings.json ]]; then
rm -f ~/.claude/settings.json
cp "$DOTFILES_DIR/claude/settings.json" ~/.claude/settings.json
echo " Created ~/.claude/settings.json"
else
read -p " ~/.claude/settings.json exists. Overwrite? [y/N] " response
if [[ "$response" =~ ^[Yy]$ ]]; then
cp "$DOTFILES_DIR/claude/settings.json" ~/.claude/settings.json
echo " Replaced ~/.claude/settings.json"
else
echo " Skipped ~/.claude/settings.json"
fi
fi
# ─────────────────────────────────────────────────────────────
# Set zsh as default shell
# ─────────────────────────────────────────────────────────────
if [[ "$SHELL" != *"zsh"* ]]; then
echo "Setting zsh as default shell..."
chsh -s $(which zsh)
fi
echo ""
echo "════════════════════════════════════════════════════════════"
echo " Done!"
echo "════════════════════════════════════════════════════════════"
echo ""
echo " Next steps:"
echo " 1. Restart your terminal (or run: source ~/.zshrc)"
echo " 2. Set terminal font to 'JetBrainsMono Nerd Font'"
echo ""
echo " Tips:"
echo " - Ghostty themes: run 'ghostty +list-themes' to see options"
echo " - Use 'z <partial-dir>' to jump to directories with zoxide"
echo ""