Last active
March 23, 2025 02:22
-
-
Save seungjulee/2de05d6c12bb9b799e1c41f8d6ef8b30 to your computer and use it in GitHub Desktop.
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 | |
# Update and install required packages | |
sudo apt-get update | |
sudo apt install -y zsh-autosuggestions zsh-syntax-highlighting zsh fzf | |
# Install Oh My Zsh non-interactively (with auto-answers) | |
# Use RUNZSH=no to prevent launching zsh after install | |
# Use CHSH=yes to automatically change the shell | |
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended | |
# Clone needed plugins | |
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting | |
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autocomplete | |
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab | |
ZSHRC_FILE="$HOME/.zshrc" | |
# Check if the file exists | |
if [ ! -f "$ZSHRC_FILE" ]; then | |
echo "Error: $ZSHRC_FILE does not exist." | |
exit 1 | |
fi | |
# Replace the plugins line | |
sed -i 's/plugins=(git)/plugins=(git fzf-tab zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting)/' "$ZSHRC_FILE" | |
# Check if the replacement was successful | |
if grep -q "plugins=(git fzf-tab zsh-autosuggestions zsh-syntax-highlighting fast-syntax-highlighting)" "$ZSHRC_FILE"; then | |
echo "Successfully updated plugins in $ZSHRC_FILE" | |
else | |
echo "Warning: Could not find or update the plugins line in $ZSHRC_FILE" | |
echo "You may need to manually edit the file." | |
fi | |
echo "Oh My Zsh installation complete with all plugins configured!" | |
echo "Your shell has been changed to zsh. To start using it now, run:" | |
echo "exec zsh" | |
zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment