-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_once_30.install_utils.zsh.tmpl
executable file
·69 lines (60 loc) · 1.82 KB
/
run_once_30.install_utils.zsh.tmpl
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
#!/usr/bin/env zsh
if [ -f /bin/zsh ]; then
chsh -s /bin/zsh
elif [ -f /usr/bin/zsh ; then
chsh -s /usr/bin/zsh
else
chsh -s $(which zsh)
fi
# External plugins (initialized before)
if [ "$(command -v curl)" ]; then
export WEB_INSTALLER="curl -L"
elif [ "$(command -v wget)" ]; then
export WEB_INSTALLER="wget -qO-"
else
echo "To install we need curl or wget to be installed to proceed." >&2
exit 1
fi
##############################
# Starship prompt #
##############################
mkdir -p $HOME/.bin
if ! type starship &> /dev/null; then
{{ if eq .chezmoi.arch "arm64" }}
brew install -s --build-from-source starship
{{ end }}
{{ if ne .chezmoi.arch "arm64" }}
brew install -s starship
{{ end }}
fi
##############################
# ZINIT #
##############################
if [ ! "$(command -v zi)" ]; then
zi_home="${HOME}/.zi"
sh -c "$(curl -fsSL https://git.io/get-zi)" -- -i skip
fi
##############################
# tools auto install #
##############################
if ! type fzf &> /dev/null; then
brew install fzf
$(brew --prefix)/opt/fzf/install --completion --key-bindings --no-update-rc --no-bash --no-fish
fi
if ! type mdv &> /dev/null; then
echo "Installing 'mdv'..."
pip3 install --user mdv
fi
[ ! -d $HOME/.autoload-zsh ] && mkdir -p $HOME/.autoload-zsh
if [ ! -f "$HOME/.autoload-zsh/_fzf_compgen_path" ]; then
echo "#! /usr/bin/env zsh" > $HOME/.autoload-zsh/_fzf_compgen_path
declare -f _fzf_compgen_path >> $HOME/.autoload-zsh/_fzf_compgen_path
fi
if [ ! -f "$HOME/.autoload-zsh/_fzf_compgen_dir" ]; then
echo "#! /usr/bin/env zsh" > $HOME/.autoload-zsh/_fzf_compgen_dir
declare -f _fzf_compgen_dir >> $HOME/.autoload-zsh/.
fi
{{ if .enable.rust }}
eval $WEB_INSTALLER https://sh.rustup.rs | bash -s -- -y --no-modify-path
cargo install xcp
{{ end }}