Skip to content

Instantly share code, notes, and snippets.

@dnegi-dev
Created December 18, 2023 07:13
Show Gist options
  • Save dnegi-dev/70a4a96730bc1c062fd512165fb04c30 to your computer and use it in GitHub Desktop.
Save dnegi-dev/70a4a96730bc1c062fd512165fb04c30 to your computer and use it in GitHub Desktop.
install_zsh_plugins.sh
#!/bin/bash
# Check if zsh is installed
if ! command -v zsh &> /dev/null; then
echo "Zsh is not installed. Please install it first."
exit 1
fi
if ! command -v git &> /dev/null; then
echo "Git is not installed, Please install it first."
exit 1
fi
# Set the ZSH custom plugins directory
ZSH_CUSTOM_PLUGINS_DIR=$HOME/.oh-my-zsh/custom/plugins
# Clone zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_CUSTOM_PLUGINS_DIR"/zsh-autosuggestions
# Clone zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-history-substring-search.git "$ZSH_CUSTOM_PLUGINS_DIR"/zsh-history-substring-search
# Clone zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM_PLUGINS_DIR"/zsh-syntax-highlighting
# Update zsh configuration to activate plugins and change theme
sed -i -E 's/^plugins=\((.*)\)/plugins=(\1 zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search )/' "$HOME"/.zshrc
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="gentoo"/' "$HOME"/.zshrc
echo "Zsh plugins installation completed. Please restart your shell to apply changes."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment