-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotfiles.sh
executable file
·91 lines (82 loc) · 1.94 KB
/
dotfiles.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
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
#!/bin/bash
THISDIR=$(dirname -- "$(readlink -f -- "$0";)";)
CONFIG_HOME="$HOME/.config"
function is_symlink_to {
if [[ -L "$2" ]]; then
if [[ "$(readlink -f "$2")" == "$(readlink -f "$1")" ]]; then
return 0
fi
fi
return 1
}
function link_config {
if ! is_symlink_to "$THISDIR/$1" "$CONFIG_HOME/$1"; then
ln -s "$THISDIR/$1" "$CONFIG_HOME/$1"
echo -e "Linked $1 config ($THISDIR/$1 -> $CONFIG_HOME/$1)"
else
echo -e "Already linked $1 config. Skipping..."
fi
}
function kitty {
link_config kitty
}
function nvim {
link_config nvim
}
function tmux {
if [[ ! -d "$HOME/.tmux/plugins/tpm" ]]; then
echo -e "Installing Tmux Plugin Manager (tpm)..."
mkdir -p "$HOME/.tmux/plugins"
git clone --depth=1 "https://github.com/tmux-plugins/tpm" "$HOME/.tmux/plugins/tpm" &> /dev/null
fi
link_config tmux
}
function zsh {
if [[ ! -d "$HOME/antigen" ]]; then
echo -e "Installing Antigen package manager..."
mkdir -p "$HOME/antigen"
curl -L git.io/antigen > "$HOME/antigen/antigen.zsh"
fi
}
function help {
echo -e "Usage: $0 [command] [options]"
echo -e ""
echo -e "This script runs any setup steps required for dotfiles in this repository"
echo -e ""
echo -e "Commands:"
echo -e " setup kitty Setup kitty terminal configuration"
echo -e " setup nvim Setup Neovim configuration"
echo -e " setup tmux Setup Tmux configuration with Tmux Plugin Manager (TPM)"
echo -e " setup zsh Setup Zsh configuration with Antigen package manager"
echo -e ""
echo -e "Options:"
echo -e " -h, --help Show this help message and exit"
}
case "$1" in
setup)
case "$2" in
kitty)
kitty
;;
nvim)
nvim
;;
tmux)
tmux
;;
zsh)
zsh
;;
*)
echo -e "Invalid setup command: $2"
exit 1
;;
esac
;;
-h|--help)
help
;;
*)
exit 1
;;
esac