-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate-symlinks.sh
More file actions
executable file
·49 lines (40 loc) · 1.21 KB
/
create-symlinks.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.21 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
#!/usr/bin/env bash
set -eo pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
reset="\\e[0m"
# red="\\e[0;31m"
green="\\e[0;32m"
yellow="\\e[0;33m"
cyan="\\e[0;36m"
# white="\\e[0;37m"
function fancy_echo() {
local color=${2:-$cyan}
local fmt="$color$1$reset"; shift
# shellcheck disable=SC2059
printf "$fmt\\n" "$@"
}
function symlink() {
input_file="$1"
symlink="$2"
if [ -L "$symlink" ]; then
fancy_echo "Symlink $symlink exists" "$green"
elif [ -f "$symlink" ]; then
fancy_echo "$symlink exists but is a file, skipping" "$yellow"
elif [ -d "$symlink" ]; then
fancy_echo "$symlink exists but is a dir, skipping" "$yellow"
else
fancy_echo "Creating $symlink -> $input_file"
ln -s "$input_file" "$symlink"
fi
}
# Symlink files
symlink "$DIR/aliases" "$HOME/.aliases"
symlink "$DIR/config/nvim/init.lua" "$HOME/.config/nvim/init.lua"
symlink "$DIR/config/ghostty/config" "$HOME/.config/ghostty/config"
symlink "$DIR/gitconfig" "$HOME/.gitconfig"
symlink "$DIR/gitignore_global" "$HOME/.gitignore_global"
symlink "$DIR/rgignore" "$HOME/.rgignore"
symlink "$DIR/tmux.conf" "$HOME/.tmux.conf"
symlink "$DIR/zshrc" "$HOME/.zshrc"
# Symlink dirs
symlink "$DIR/bin" "$HOME/.bin"