Created
April 2, 2024 09:11
-
-
Save shorefall/4fbdb5aa9ca164e4d3bc0b5bd1648f70 to your computer and use it in GitHub Desktop.
Fix bash shell by installing zsh and autojump,autosuggest & agnoster
This file contains 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 | |
# Function to install Oh My Zsh | |
install_oh_my_zsh() { | |
# Check if Zsh is installed | |
if ! command -v zsh &> /dev/null; then | |
echo "Zsh is not installed. Installing Zsh..." | |
sudo apt-get update | |
sudo apt-get install -y zsh | |
fi | |
# Check if Oh My Zsh is already installed | |
if [ ! -d "$HOME/.oh-my-zsh" ]; then | |
echo "Installing Oh My Zsh..." | |
# Download and execute the install script with the --unattended flag | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
# Change the default shell to Zsh | |
echo "Changing the default shell to Zsh..." | |
chsh -s "$(which zsh)" | |
else | |
echo "Oh My Zsh is already installed." | |
fi | |
} | |
# Function to set Agnoster theme in Oh My Zsh | |
set_agnoster_theme() { | |
echo "Setting Agnoster theme..." | |
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="agnoster"/' ~/.zshrc | |
} | |
# Function to install Autojump | |
install_autojump() { | |
echo "Installing Autojump..." | |
sudo apt-get install -y autojump | |
echo '[[ -s /usr/share/autojump/autojump.sh ]] && . /usr/share/autojump/autojump.sh' >> ~/.zshrc | |
} | |
# Function to install Autosuggest plugin | |
install_autosuggest() { | |
echo "Installing zsh-autosuggestions..." | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
echo 'source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh' >> ~/.zshrc | |
echo "plugins=(\${plugins[@]} zsh-autosuggestions)" >> ~/.zshrc | |
} | |
# Function to install Powerline Fonts | |
install_powerline_fonts() { | |
echo "Installing Powerline Fonts..." | |
sudo apt install fonts-powerline | |
} | |
# Main installation process | |
install_oh_my_zsh | |
set_agnoster_theme | |
install_autojump | |
install_autosuggest | |
install_powerline_fonts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment