Last active
August 8, 2021 12:57
-
-
Save soifou/c99be4373f6ffe3b4ff7 to your computer and use it in GitHub Desktop.
Quickly setup zsh powered by antigen on fresh Debian servers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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