-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·103 lines (77 loc) · 2.84 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·103 lines (77 loc) · 2.84 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
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$script_dir/install-packages.sh"
resolved_zsh_path="$(resolve_zsh_path || true)"
packages=(stow zsh tmux starship fzf zsh-autosuggestions eza zoxide sesh bat git-delta)
if [ "$(uname -s)" = "Darwin" ]; then
packages+=(ghostty)
elif [ "$(uname -s)" = "Linux" ]; then
packages+=(build-essential)
fi
zsh_path="$(install_packages_auto --print-zsh-path "${packages[@]}")"
if [ -z "${zsh_path:-}" ]; then
zsh_path="$resolved_zsh_path"
fi
if [ "$(uname -s)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then
if ! brew list --cask aerospace >/dev/null 2>&1; then
brew install --cask nikitabobko/tap/aerospace
else
echo "✅ Already installed: aerospace"
fi
if ! brew list --cask hammerspoon >/dev/null 2>&1; then
brew install --cask hammerspoon
else
echo "✅ Already installed: hammerspoon"
fi
if ! brew list --cask ghostty >/dev/null 2>&1; then
brew install --cask ghostty
else
echo "✅ Already installed: ghostty"
fi
fi
if [ -n "${zsh_path:-}" ] && [ -x "$zsh_path" ]; then
current_shell_path="${SHELL:-}"
if [ ! -x "$current_shell_path" ] || [ "$current_shell_path" != "$zsh_path" ]; then
if ! grep -q "$zsh_path" /etc/shells; then
echo "Adding $zsh_path to /etc/shells (requires sudo)."
echo "$zsh_path" | sudo tee -a /etc/shells >/dev/null
fi
echo "Setting login shell to $zsh_path."
chsh -s "$zsh_path"
fi
fi
if [ -e "$HOME/.zshrc" ] && [ ! -L "$HOME/.zshrc" ]; then
backup_path="$HOME/.zshrc.backup.$(date +%Y%m%d%H%M%S)"
mv "$HOME/.zshrc" "$backup_path"
echo "Backed up existing .zshrc to $backup_path"
fi
if [ ! -d "$HOME/.config" ]; then
mkdir "$HOME/.config"
fi
install_neovim_latest
stow_packages=(zsh tmux git claude)
if [ "$(uname -s)" = "Darwin" ]; then
stow_packages+=(aerospace hammerspoon)
fi
stow --dotfiles --target="$HOME" "${stow_packages[@]}"
stow --target="$HOME/.config" --ignore='^(zsh|tmux|aerospace|hammerspoon)$' .
if command -v zsh >/dev/null 2>&1 && [ -f "$HOME/.zshrc" ]; then
ZDOTDIR="$HOME" zsh -i -c 'exit'
fi
if [ ! -d "$HOME/.tmux/plugins/tpm" ]; then
git clone https://github.com/tmux-plugins/tpm "$HOME/.tmux/plugins/tpm"
fi
tmux start-server \; set-environment -g TMUX_PLUGIN_MANAGER_PATH "$HOME/.tmux/plugins"
"$HOME/.tmux/plugins/tpm/bin/install_plugins"
if command -v zsh >/dev/null 2>&1 && [ -f "$HOME/.zshrc" ] && [ -z "${SETUP_SKIP_SHELL_RELOAD:-}" ] && [ -t 0 ] && [ -t 1 ]; then
echo "Reloading zsh to apply updated shell aliases."
reload_zsh_path="${zsh_path:-}"
if [ -z "$reload_zsh_path" ]; then
reload_zsh_path="$(resolve_zsh_path || true)"
fi
if [ -n "$reload_zsh_path" ] && [ -x "$reload_zsh_path" ]; then
exec "$reload_zsh_path" -i
fi
echo "Skipping zsh reload because no executable zsh path was resolved."
fi