-
-
Save zyc945/2a144887a7ebd19df19fea127fd7e3e8 to your computer and use it in GitHub Desktop.
Setup Oh My Zsh and PowerLevel10k
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/zsh | |
set -e | |
if [ -d "$HOME/.oh-my-zsh" ]; then | |
echo "Oh My ZSH is installed" | |
else | |
echo "Download and install Oh My ZSH before running this script" | |
echo 'sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"' | |
exit 1 | |
fi | |
# Install PowerLevel10k | |
if [ -d "$ZSH_CUSTOM/themes/powerlevel10k" ]; then | |
echo "PowerLevel10k is already installed" | |
else | |
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k | |
sed -i.bak 's/ZSH_THEME\="robbyrussell"/ZSH_THEME\="powerlevel10k\/powerlevel10k"\ | |
POWERLEVEL9K_MODE="awesome-patched"/g' ~/.zshrc | |
fi | |
# Download Input fonts | |
curl -s -o Input_Font.zip 'https://input.fontbureau.com/build/?fontSelection=fourStyleFamily®ular=InputMono-Light&italic=InputMono-LightItalic&bold=InputMono-Medium&boldItalic=InputMono-MediumItalic&a=ss&g=ss&i=serifs&l=serifs&zero=slash&asterisk=0&braces=0&preset=default&line-height=1.2&accept=I+do' | |
unzip Input_Font.zip -d Input_Font | |
# Patch Input fonts | |
if [[ $OSTYPE == "darwin" ]]; then | |
brew install fontforge | |
elif [[ $OSTYPE == "linux-gnu" ]]; then | |
apt install -y fontforge python-pip | |
pip install configparser | |
fi | |
curl -s -o font-patcher https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/font-patcher | |
GLYPHS=`curl -s https://github.com/ryanoasis/nerd-fonts/tree/master/src/glyphs | grep -o 'ryanoasis/nerd-fonts/blob/master/src/glyphs/[a-zA-Z% 0-9_-]*\.[a-z][a-z][a-z]'` | |
mkdir -p src/glyphs | |
for glyph in `echo "$GLYPHS" | tr '\n' ' '`; do | |
glyph_path=src/glyphs/`basename $glyph | sed 's/%20/ /g'` | |
glyph_url="https://github.com/$glyph?raw=true" | |
if [ -f $glyph_path ]; then | |
echo "Already have $glyph_path" | |
else | |
echo "Getting $glyph_url" | |
curl -L -s -o $glyph_path $glyph_url | |
fi | |
done | |
for font in Input_Font/Input_Fonts/Input/*.ttf; do | |
fontforge -script font-patcher --careful --complete --progressbars $font | |
done | |
# Install fonts | |
if [[ $OSTYPE == "darwin" ]]; then | |
open -a 'Font Book' 'Input '* | |
else | |
echo "Install these fonts to continue:" | |
ls 'Input '* | |
fi | |
# Install chelys | |
[ ! -f $HOME/.chelys/chelys.sh ] && git clone https://github.com/MartinHarding/chelys $HOME/.chelys | |
# Get .zshrc | |
if [ -f .zshrc ]; then | |
mv .zshrc .zshrc-original | |
fi | |
git clone https://gist.github.com/2e2f243c8cc542abed08aeb5475dd6f0.git $HOME/.zshrc-gist | |
ln -s $HOME/.zshrc-gist/.zshrc $HOME/.zshrc | |
ln -s $HOME/.zshrc-gist/.p10k.zsh $HOME/.p10k.zsh | |
# Silence last login message | |
touch .hushlogin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment