-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·120 lines (100 loc) · 4.14 KB
/
setup.sh
File metadata and controls
executable file
·120 lines (100 loc) · 4.14 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
#!/bin/bash
set -e # Exit on error
DOTFILES_DIR="$HOME/dotfiles"
echo "=================================="
echo "Dotfiles Setup Script"
echo "=================================="
echo ""
# Function to create backup or keep correct symlink
backup_if_exists() {
# $1 = destination path, $2 = expected target
if [ -L "$1" ]; then
local current_target="$(readlink "$1")"
if [ "$current_target" = "$2" ]; then
echo "Symlink $1 already points to $2; skipping."
return 0
else
echo "Removing existing symlink $1 (was -> $current_target)"
rm "$1"
fi
elif [ -e "$1" ]; then
echo "Backing up existing $1 to $1.backup"
mv "$1" "$1.backup"
fi
}
# Backup and symlink .zshrc
echo "Setting up zsh configuration..."
backup_if_exists "$HOME/.zshrc" "$DOTFILES_DIR/.zshrc"
ln -sf "$DOTFILES_DIR/.zshrc" "$HOME/.zshrc"
# Backup and symlink starship.toml
echo "Setting up starship configuration..."
mkdir -p "$HOME/.config"
backup_if_exists "$HOME/.config/starship.toml" "$DOTFILES_DIR/starship.toml"
ln -sf "$DOTFILES_DIR/starship.toml" "$HOME/.config/starship.toml"
# Backup and symlink git config directory
echo "Setting up git configuration..."
backup_if_exists "$HOME/.config/git" "$DOTFILES_DIR/git"
ln -sf "$DOTFILES_DIR/git" "$HOME/.config/git"
# Backup and symlink waybar
echo "Setting up waybar configuration..."
backup_if_exists "$HOME/.config/waybar" "$DOTFILES_DIR/.config/waybar"
ln -sf "$DOTFILES_DIR/.config/waybar" "$HOME/.config/waybar"
# Backup and symlink nvim
echo "Setting up neovim configuration..."
backup_if_exists "$HOME/.config/nvim" "$DOTFILES_DIR/.config/nvim"
ln -sf "$DOTFILES_DIR/.config/nvim" "$HOME/.config/nvim"
# Backup and symlink hypr
echo "Setting up hyprland configuration..."
backup_if_exists "$HOME/.config/hypr" "$DOTFILES_DIR/.config/hypr"
ln -sf "$DOTFILES_DIR/.config/hypr" "$HOME/.config/hypr"
# Backup and symlink ghostty
echo "Setting up ghostty configuration..."
backup_if_exists "$HOME/.config/ghostty" "$DOTFILES_DIR/.config/ghostty"
ln -sf "$DOTFILES_DIR/.config/ghostty" "$HOME/.config/ghostty"
# Backup and symlink fish
echo "Setting up fish configuration..."
backup_if_exists "$HOME/.config/fish" "$DOTFILES_DIR/.config/fish"
ln -sf "$DOTFILES_DIR/.config/fish" "$HOME/.config/fish"
# Backup and symlink noctalia
echo "Setting up noctalia configuration..."
backup_if_exists "$HOME/.config/noctalia" "$DOTFILES_DIR/.config/noctalia"
ln -sf "$DOTFILES_DIR/.config/noctalia" "$HOME/.config/noctalia"
# Backup and symlink niri
echo "Setting up niri configuration..."
backup_if_exists "$HOME/.config/niri" "$DOTFILES_DIR/.config/niri"
ln -sf "$DOTFILES_DIR/.config/niri" "$HOME/.config/niri"
# Backup and symlink jujutsu
echo "Setting up jujutsu configuration..."
backup_if_exists "$HOME/.config/jj" "$DOTFILES_DIR/.config/jj"
ln -sf "$DOTFILES_DIR/.config/jj" "$HOME/.config/jj"
# Backup and symlink fastfetch
echo "Setting up fastfetch configuration..."
backup_if_exists "$HOME/.config/fastfetch" "$DOTFILES_DIR/.config/fastfetch"
ln -sf "$DOTFILES_DIR/.config/fastfetch" "$HOME/.config/fastfetch"
# Setup zsh plugins directory
echo "Setting up zsh plugins..."
mkdir -p "$HOME/.zsh"
if [ ! -d "$HOME/.zsh/zsh-autosuggestions" ]; then
echo "Linking zsh-autosuggestions..."
ln -sf /usr/share/zsh/plugins/zsh-autosuggestions "$HOME/.zsh/zsh-autosuggestions"
fi
if [ ! -d "$HOME/.zsh/fzf-tab" ]; then
echo "Installing fzf-tab..."
git clone https://github.com/Aloxaf/fzf-tab "$HOME/.zsh/fzf-tab"
fi
# Link zsh-syntax-highlighting from dotfiles
if [ ! -e "$HOME/zsh-syntax-highlighting" ]; then
echo "Linking zsh-syntax-highlighting from dotfiles..."
ln -sf "$DOTFILES_DIR/zsh/zsh-syntax-highlighting" "$HOME/zsh-syntax-highlighting"
fi
echo ""
echo "=================================="
echo "Dotfiles setup complete!"
echo "=================================="
echo ""
echo "Your configuration files have been symlinked."
echo "Backups of existing configs are saved with .backup extension."
echo ""
echo "To apply zsh changes, run: source ~/.zshrc"
echo "To switch to fish shell, run: fish"
echo "To change default shell to fish, run: chsh -s \$(which fish)"