-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.zsh
More file actions
executable file
·86 lines (67 loc) · 2.46 KB
/
Copy pathsetup.zsh
File metadata and controls
executable file
·86 lines (67 loc) · 2.46 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
#!/bin/zsh
set -e
# 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 this session
if [[ -f /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)" # macOS ARM
elif [[ -f /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)" # macOS Intel
elif [[ -f /home/linuxbrew/.linuxbrew/bin/brew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" # Linux
fi
fi
# Install tools via Brewfile
echo "Installing tools via Homebrew..."
curl -fsSL https://raw.githubusercontent.com/akash329d/dotfiles/main/Brewfile | brew bundle install --file=-
# Disable brew's atuin service - we manage daemon via zellij in zshrc
brew services stop atuin 2>/dev/null || true
# Create Sheldon config that pulls dotfiles remotely
mkdir -p ~/.config/sheldon
cat > ~/.config/sheldon/plugins.toml <<'EOM'
shell = "zsh"
# Powerlevel10k theme (must be before dotfiles so p10k.zsh works)
[plugins.powerlevel10k]
github = "romkatv/powerlevel10k"
[plugins.fzf-tab]
github = "Aloxaf/fzf-tab"
[plugins.zsh-autosuggestions]
github = "zsh-users/zsh-autosuggestions"
use = ["{{ name }}.zsh"]
[plugins.zsh-syntax-highlighting]
github = "zsh-users/zsh-syntax-highlighting"
[plugins.zsh-alias-finder]
github = "akash329d/zsh-alias-finder"
# Dotfiles - sources zshrc (tools, aliases) and p10k.zsh (theme config)
[plugins.dotfiles]
github = "akash329d/dotfiles"
use = ["zshrc", "p10k.zsh"]
EOM
# Lock/install plugins
sheldon lock
# Remove old dotfiles section if present, then add fresh
if [[ -f ~/.zshrc ]]; then
sed -i.bak '/^###### SECTION FOR DOTFILES ######$/,/^###### DOTFILES END ######$/d' ~/.zshrc
rm -f ~/.zshrc.bak
fi
cat >> ~/.zshrc <<'EOM'
###### SECTION FOR DOTFILES ######
# Homebrew
if [[ -f /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ -f /usr/local/bin/brew ]]; then
eval "$(/usr/local/bin/brew shellenv)"
elif [[ -f /home/linuxbrew/.linuxbrew/bin/brew ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# P10K Instant Prompt
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Sheldon plugins
eval "$(sheldon source)"
###### DOTFILES END ######
EOM
echo "Dotfiles installed! Restart zsh to see changes."