Skip to content

Instantly share code, notes, and snippets.

@rahulghangas
Last active June 11, 2022 20:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rahulghangas/4128147c3aa15119db6e346cd57fb0e2 to your computer and use it in GitHub Desktop.
Setting up zsh and Oh My Zsh on Ubuntu automatically with replaced theme and plugins
#!/bin/bash
# Remove existing configs and install zsh and Oh My Zsh
sudo rm -rf ~/.zsh*
sudo rm -r ~/.oh-my-zsh
sudo apt install -y curl zsh tmux
# You will need to exit Zsh shell after this command
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo $SHELL
# Copy default remplate
cp ~/.oh-my-zsh/templates/zshrc.zsh-template .zshrc
# Fetch plugin repositories
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# Replace plugins and default theme
sed -i 's/^plugins.*/plugins=(git docker extract zsh-syntax-highlighting zsh-autosuggestions)/g' ~/.zshrc
sed -i "s/^ZSH_THEME.*/ZSH_THEME='obraun'/g" ~/.zshrc
# change default shell
sudo chsh --shell /bin/zsh $USER
# set tmux configuration
echo "setw -g mouse on\nset-option -g history-limit 20000" > ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment