Skip to content

Instantly share code, notes, and snippets.

@Volcanoscar
Created July 22, 2022 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Volcanoscar/d879a35c2c10058438a6ac9da9918f77 to your computer and use it in GitHub Desktop.
Save Volcanoscar/d879a35c2c10058438a6ac9da9918f77 to your computer and use it in GitHub Desktop.
Script for installing zsh with powerlevel10k theme on linux platform
#!/bin/bash
if [ "$1" = "clean" ];
then
echo "Removing ZSH config"
rm -rf ~/.zsh
rm ~/.zshrc
rm ~/.p10k.zsh
chsh -s $(which bash)
exit
fi
# ZSH check
if ! type zsh &> /dev/null
then
echo "ZSH could not be found, ask ROOT to install it by:"
echo " sudo apt-get install zsh"
exit
fi
# CONDA init
if type conda &> /dev/null
then
conda init zsh
fi
# DIR creating
touch ~/.zshrc
if [ ! -d ~/.zsh ]; then
mkdir -p ~/.zsh;
fi
# ALIAS setting
echo "alias ls='ls --color'" >> ~/.zshrc
echo "alias ll='ls -al'" >> ~/.zshrc
echo "alias python='python3'" >> ~/.zshrc
echo "alias py='python3'" >> ~/.zshrc
# PLUGINS
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.zsh/powerlevel10k
status=$?
if [ $status -eq 0 ]; then
echo "Pull p10k theme"
else
echo ">Failed"
exit
fi
echo 'source ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme' >>~/.zshrc
echo '[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh' >>~/.zshrc
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/plugins/zsh-syntax-highlighting
status=$?
if [ $status -eq 0 ]; then
echo "Pull syntax-highlighting theme"
else
echo ">Failed"
exit
fi
echo "source ~/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/plugins/zsh-autosuggestions
status=$?
if [ $status -eq 0 ]; then
echo "Pull auto-suggestions theme"
else
echo ">Failed"
exit
fi
echo "source ~/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" >> ~/.zshrc
# RUN
echo "[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'" >> ~/.zshrc
# ENTER
chsh -s $(which zsh)
zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment