-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·61 lines (49 loc) · 1.22 KB
/
install.sh
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
#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
create_symlink() {
local source=$1
local target=$2
if [ ! -f "$source" ]; then
echo "Source file does not exist: $source"
exit 1
fi
if [ -e "$target" ]; then
echo "Target already exists, backing up: $target.bak"
mv "$target" "${target}.bak"
fi
mkdir -p "$(dirname "$target")"
ln -nfs "$source" "$target"
echo "Symlink created: $target -> $source"
if [ -e "${target}.bak" ]; then
rm "${target}.bak"
fi
}
# Neovim
echo "Setting up Neovim..."
SOURCE="$SCRIPT_DIR/init.lua"
TARGET="$HOME/.config/nvim/init.lua"
create_symlink "$SOURCE" "$TARGET"
# Tmux
echo
echo "Setting up tmux..."
SOURCE="$SCRIPT_DIR/.tmux.conf"
TARGET="$HOME/.tmux.conf"
create_symlink "$SOURCE" "$TARGET"
# Git config
echo
echo "Applying git config..."
SOURCE="$SCRIPT_DIR/.gitconfig"
TARGET="$HOME/.gitconfig"
create_symlink "$SOURCE" "$TARGET"
# .bashrc
echo
echo "Linking .bashrc..."
SOURCE="$SCRIPT_DIR/.bashrc"
TARGET="$HOME/.bashrc"
create_symlink "$SOURCE" "$TARGET"
# Starship
echo
echo "Linking starship.toml..."
SOURCE="$SCRIPT_DIR/starship.toml"
TARGET="$HOME/.config/starship.toml"
create_symlink "$SOURCE" "$TARGET"