Skip to content

Instantly share code, notes, and snippets.

@zouguangxian
Last active February 10, 2023 09:40
Show Gist options
  • Save zouguangxian/91df7eae10579b4cf5edeb14ccf882d4 to your computer and use it in GitHub Desktop.
Save zouguangxian/91df7eae10579b4cf5edeb14ccf882d4 to your computer and use it in GitHub Desktop.
#!/bin/sh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
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-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -e 's/^plugins.*)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-completions)/' -e 's,^ZSH_THEME=.*,ZSH_THEME="powerlevel10k/powerlevel10k",' -i '' ~/.zshrc
cp ~/.oh-my-zsh/custom/themes/powerlevel10k/config/p10k-lean.zsh ~/.p10k.zsh
sed -i'' -e '/^[ ]*newline.*$/d' -e 's/\(POWERLEVEL9K_PROMPT_ADD_NEWLINE\)=.*/\1=false/g' -e 's/\(POWERLEVEL9K_TRANSIENT_PROMPT\)=.*/\1=always/g' ~/.p10k.zsh
echo "[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh" >> ~/.zshrc
chsh -s $(command -v zsh)