58 lines
1.5 KiB
Bash
58 lines
1.5 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Description:
|
|
# Configure zsh shell.
|
|
#
|
|
|
|
# install zsh
|
|
if ! command -v zsh &> /dev/null; then
|
|
case "$DOTS_PKG" in
|
|
apt)
|
|
sudo apt-get install -qq zsh
|
|
;;
|
|
pacman)
|
|
sudo pacman -S --noconfirm zsh
|
|
;;
|
|
brew)
|
|
brew install zsh
|
|
;;
|
|
*)
|
|
log_warn "Skipping zsh install: no supported package manager found"
|
|
return 0
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
zsh --version
|
|
|
|
# install oh-my-zsh
|
|
export ZSH="$HOME/.oh-my-zsh"
|
|
if [ ! -d "$ZSH" ]; then
|
|
# https://github.com/ohmyzsh/ohmyzsh#unattended-install
|
|
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
|
fi
|
|
export ZSH_CUSTOM="$ZSH/custom"
|
|
|
|
# install zsh-syntax-highlighting
|
|
export ZSH_SYNTAX_HIGHLIGHTING="$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
|
|
if [ ! -d "$ZSH_SYNTAX_HIGHLIGHTING" ]; then
|
|
git clone -q \
|
|
https://github.com/zsh-users/zsh-syntax-highlighting.git \
|
|
"$ZSH_SYNTAX_HIGHLIGHTING"
|
|
fi
|
|
|
|
# install zsh-autosuggestions
|
|
export ZSH_AUTOSUGGESTIONS="$ZSH_CUSTOM/plugins/zsh-autosuggestions"
|
|
if [ ! -d "$ZSH_AUTOSUGGESTIONS" ]; then
|
|
git clone -q \
|
|
https://github.com/zsh-users/zsh-autosuggestions.git \
|
|
"$ZSH_AUTOSUGGESTIONS"
|
|
fi
|
|
|
|
# change default shell to zsh
|
|
if [[ "$SHELL" != *zsh ]]; then
|
|
sudo chsh -s "$(command -v zsh)" "$(whoami)"
|
|
sudo usermod -s "$(command -v zsh)" "$(whoami)"
|
|
fi
|