-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_once_before-installl_zsh_prezto.sh.tmpl
40 lines (31 loc) · 1.56 KB
/
run_once_before-installl_zsh_prezto.sh.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
#!/bin/zsh
# This shell code is zsh, it fails run as bash
# https://github.com/sorin-ionescu/prezto
function install_prezto() {
echo "Intalling/Updating prezto if needed"
# Install Prezo if it isn't already present
if [[ ! -d $HOME/.zprezto/ ]]; then
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
# Skip readme and files which need further modification
# zshrc: need custom configuration. The workaround is to add 'source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"'
# at the beggining of the file
# zpreztorc: we need to add the desired module in line -> zstyle ':prezto:module:prompt' theme 'powerlevel10k'
# this module requires to load the p10k configuration from zshrc with -> [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^(README.md|zshrc|zpreztorc)(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
# Installing the powerlevel9k theme
git clone https://github.com/bhilburn/powerlevel9k.git ~/.zprezto/modules/prompt/external/powerlevel9k
# If we want to uninstall it, just remove the ~/.zprezto folder
# Install powerline fonts (it requires execute chezmoi --refresh-externals apply as depends on configured external repo)
echo "Installing powerline fonts"
CHEZMOI_DIR=$(chezmoi source-path)
$CHEZMOI_DIR/powerline/fonts/install.sh
else
echo "Prezto already installed"
cd $HOME/.zprezto/
git pull && git submodule update --init --recursive
fi
}
install_prezto