Skip to content

Instantly share code, notes, and snippets.

@bishwajitcadhikary
Created August 20, 2023 00:29
Show Gist options
  • Save bishwajitcadhikary/c6793100b954666330a9813980280f52 to your computer and use it in GitHub Desktop.
Save bishwajitcadhikary/c6793100b954666330a9813980280f52 to your computer and use it in GitHub Desktop.
ZSH & Powerlevel10k Auto Installation
#!/bin/bash
# Function to install ZSH, Antigen ZSH, and Powerlevel10k
install() {
# Install ZSH
echo "Installing ZSH..."
case $PKG_MANAGER in
apt)
sudo apt update
sudo apt install -y zsh
;;
dnf)
sudo dnf install -y zsh
;;
pacman)
sudo pacman -Syu --noconfirm zsh
;;
*)
echo "Unsupported package manager: $PKG_MANAGER"
exit 1
;;
esac
# Install Antigen ZSH
echo "Installing Antigen ZSH..."
curl -L git.io/antigen > $HOME/antigen.zsh
# Create .zshrc and paste the content
echo "Creating .zshrc..."
cat <<EOF > $HOME/.zshrc
source $HOME/antigen.zsh
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles
antigen bundle git
antigen bundle laravel
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle command-not-found
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
# Load the theme.
antigen theme romkatv/powerlevel10k
# Tell Antigen that you're done.
antigen apply
EOF
# Change default shell to ZSH
echo "Changing default shell to ZSH..."
chsh -s $(which zsh)
echo "Installation completed. Please restart your terminal."
}
# Detect package manager
if [ -x "$(command -v apt)" ]; then
PKG_MANAGER="apt"
elif [ -x "$(command -v dnf)" ]; then
PKG_MANAGER="dnf"
elif [ -x "$(command -v pacman)" ]; then
PKG_MANAGER="pacman"
else
echo "Unsupported package manager."
exit 1
fi
install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment