Skip to content

Instantly share code, notes, and snippets.

@soifou
Last active August 8, 2021 12:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soifou/c99be4373f6ffe3b4ff7 to your computer and use it in GitHub Desktop.
Save soifou/c99be4373f6ffe3b4ff7 to your computer and use it in GitHub Desktop.
Quickly setup zsh powered by antigen on fresh Debian servers
#!/bin/bash
# Quickly setup Zsh powered by antigen on fresh Debian servers
# Usage: bash -c "$(curl -fsSL https://gist.githubusercontent.com/soifou/c99be4373f6ffe3b4ff7/raw/COMMIT_ID/zsh-antigen-debian.sh)"
if [[ $(which zsh | wc -m) == 0 ]]; then
echo "Zsh is not installed... installing"
sudo apt-get install -y zsh
fi
if [[ $(which curl | wc -m) == 0 ]]; then
echo "Curl is not installed... installing"
sudo apt-get install -y curl
fi
if [[ ! -d $HOME/.antigen ]]; then
echo "Clone antigen repository..."
mkdir $HOME/.antigen
curl -L git.io/antigen > $HOME/.antigen/antigen.zsh
fi
if [[ -f $HOME/.zshrc ]]; then
echo "Found existing zshrc... backup"
mv $HOME/.zshrc $HOME/.zshrc.dotbackup
fi
echo "Configuring zshrc..."
cat > "$HOME/.zshrc" <<EOF
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
source $HOME/.antigen/antigen.zsh
antigen use oh-my-zsh
antigen bundle debian
antigen bundle git
antigen bundle command-not-found
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-history-substring-search
antigen theme bureau
antigen apply
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
EOF
CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
if [ "$CURRENT_SHELL" != "zsh" ]; then
echo "\033[0;34mTime to change your default shell to zsh!\033[0m"
sudo chsh --shell=$(grep /zsh$ /etc/shells | tail -1) $USER
fi
unset CURRENT_SHELL
echo "Reload shell..."
env zsh
source $HOME/.zshrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment