Last active
June 30, 2025 10:54
-
-
Save zouguangxian/971ae942b010508ad9431a847250d4f0 to your computer and use it in GitHub Desktop.
setup zsh with powerlevel10k in debian/ubuntu environment
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/sh | |
| [ -f /etc/dpkg/dpkg.cfg.d/excludes ] && sed -i'' "s:^path-exclude=.*:#path-exclude=.*:" /etc/dpkg/dpkg.cfg.d/excludes | |
| apt-get update && apt-get install -y --no-install-recommends zsh git fzf && rm -rf /var/lib/apt/lists/* | |
| [ -f /etc/dpkg/dpkg.cfg.d/excludes ] && sed -i'' "s:^#path-exclude=.*:path-exclude=.*:" /etc/dpkg/dpkg.cfg.d/excludes | |
| 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 -i'' -e 's/^plugins.*)/plugins=(z fzf git zsh-autosuggestions zsh-syntax-highlighting zsh-completions docker)/' \ | |
| -e '/^ZSH_THEME=.*/{ | |
| r /dev/stdin | |
| d | |
| }' ~/.zshrc <<< $'if [[ "$PAGER" == "head -n 10000 | cat" ]]; then\n ZSH_THEME="robbyrussell"\nelse\n ZSH_THEME="powerlevel10k/powerlevel10k"\nfi' | |
| 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment