helm/shell/zsh/_init
2018-03-23 15:30:15 -04:00

45 lines
990 B
Bash
Executable file

#!/usr/bin/env zsh
source ${0:A:h}/../../deploy
source .zshenv
install() {
local zshenv=/etc/zsh/zshenv
case $(_os) in
macos) brew install zsh fasd fd
zshenv=/etc/zshenv
;;
arch) sudo pacman --needed --noconfirm -S zsh fasd fd
;;
debian) sudo add-apt-repository ppa:aacebedo/fasd
sudo apt-get update && sudo apt-get install -y zsh fasd fd
;;
esac
[[ $SHELL == */zsh ]] || chsh -s $(which zsh) $(whoami)
local zsh="$(which zsh)"
grep $zsh /etc/shells &>/dev/null || sudo tee -a /etc/shells <<<$zsh
sudo tee $zshenv <<<"export ZDOTDIR=\"${ZDOTDIR/$HOME/\$HOME}\""
}
update() {
if [[ -e $ZGEN_SOURCE/zgen.zsh ]]; then
source $ZGEN_SOURCE/zgen.zsh
zgen selfupdate
zgen update
fi
}
link() {
mklink .zsh* $ZDOTDIR/
mklink functions $ZDOTDIR/
[[ $(_os) == macos ]] && mklink .zshenv ~/.zshenv
}
clean() {
rm -rfv $ZDOTDIR
[[ $(_os) == macos ]] && rm -f ~/.zshenv
}
init "$@"