summaryrefslogtreecommitdiff
path: root/modules/20-zsh/install.sh
blob: a4d4587a29226e8adaf8f6da610c7dc05716e2a3 (plain) (blame)
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
_script="$(realpath ${BASH_SOURCE[0]})"
_scriptname="$(basename $_script)"
_scriptdir="$(dirname $_script)"
_modulename="$(basename $_scriptdir)"
DOT_MODULE_NAME="i3"

function preinstall() {
	if ! [[ -x "$(command -v zsh)" ]]; then
		PACKAGES+=("zsh")
	fi
}

function install() {
	if ! [[ -d "$HOME/.oh-my-zsh" ]]; then
		sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
	fi

	if ! [[ -d "$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" ]]; then
		git clone https://github.com/zsh-users/zsh-autosuggestions.git "$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions"
	else
		cd "$HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" && git pull
	fi

	if ! [[ -d "$HOME/.oh-my-zsh/custom/plugins/zsh-completions" ]]; then
		git clone https://github.com/zsh-users/zsh-completions.git "$HOME/.oh-my-zsh/custom/plugins/zsh-completions"
	else
		cd "$HOME/.oh-my-zsh/custom/plugins/zsh-completions" && git pull
	fi

	if ! [[ -d "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" ]]; then
		git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting"
	else
		cd "$HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting" && git pull
	fi

	ln -f "$_scriptdir/zshrc" "$HOME/.zshrc"
}