helm/shell/zsh/_init

44 lines
952 B
Bash
Executable file

#!/usr/bin/env zsh
source ${0:A:h}/../../deploy
source .zshenv
install() {
local zshenv=/etc/zshenv
case $(_os) in
macos) brew install zsh fasd ;;
arch) sudo pacman --needed --noconfirm -S zsh fasd
zshenv=/etc/zsh/zshenv
;;
debian) sudo add-apt-repository ppa:aacebedo/fasd
sudo apt-get update && sudo apt-get install -y zsh fasd
;;
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'"
}
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 "$@"