This commit is contained in:
2026-07-10 15:11:51 +08:00
parent 8bfcf23bc2
commit da17239d7d
148 changed files with 2542 additions and 4873 deletions
+60 -52
View File
@@ -1,60 +1,68 @@
#!/usr/bin/env bash
##makedesc: Install omz fancy (powerline10k + MesloLGS font)
# https://gist.github.com/anthonyaxenov/b8460935d06b9f0da72def03d0f26515
set -eo pipefail
# Based on:
# https://github.com/Powerlevel9k/powerlevel9k/wiki/Install-Instructions
# https://github.com/ohmyzsh/ohmyzsh
# https://powerline.readthedocs.io/en/latest/installation/linux.html#fonts-installation
# https://gist.github.com/dogrocker/1efb8fd9427779c827058f873b94df95
# https://linuxhint.com/install_zsh_shell_ubuntu_1804/
installed() { command -v "$1" >/dev/null 2>&1; }
echo
echo "==============================================="
echo "Installing omz fancy: powerline10k + MesloLGS font..."
echo "==============================================="
echo
isMac() { [ "$(uname -s)" = "Darwin" ]; }
installed() {
command -v "$1" >/dev/null 2>&1
install() {
echo
echo "==============================================="
echo "Installing omz fancy: powerline10k + MesloLGS font"
echo "==============================================="
echo
if ! installed zsh || ! installed git; then
echo "ERROR: you need git and zsh to be installed!" >&2
exit 1
fi
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
echo "ERROR: you need omz to be installed!" >&2
exit 1
fi
echo
echo "1/3 Installing MesloLGS fonts..."
mkdir -p "$HOME/.local/share/fonts/"
FONTS_URL="https://github.com/romkatv/powerlevel10k-media/raw/master"
if installed wget; then
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
wget -q --show-progress "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
else
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
curl -fsSL "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -o "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
fi
if command -v fc-cache >/dev/null 2>&1; then
fc-cache -vf "$HOME/.local/share/fonts/"
fi
echo
echo "2/3 Installing powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
sed -i.bak 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' "$HOME/.zshrc"
echo
echo "3/3 Installing plugins..."
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions"
git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting"
sed -i.bak 's/^plugins=/plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)/g' "$HOME/.zshrc"
p10k configure
echo
echo "Finish! You need to:"
echo "- review your plugins in $HOME/.zshrc"
echo "- restart terminal windows to reload fonts and set 'MesloLGS NF Regular' as default font"
echo "- log out of your session and login again"
echo
}
if ! installed zsh || ! installed git || ! installed wget; then
echo "ERROR: you need git, zsh and wget to be installed!"
exit 1
fi
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
echo "ERROR: you need omz to be installed!"
exit 1
fi
echo
echo "1/3 Installing MesloLGS fonts..."
mkdir -p "$HOME/.local/share/fonts/"
FONTS_URL="https://github.com/romkatv/powerlevel10k-media/raw/master"
wget "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
fc-cache -vf "$HOME/.local/share/fonts/"
echo
echo "2/3 Installing powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' "$HOME/.zshrc"
echo
echo "3/3 Installing plugins..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i 's/^plugins=/plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)/g' $HOME/.zshrc
p10k configure
echo
echo "Finish! You need to:"
echo "- review your plugins in $HOME/.zshrc"
echo "- restart terminal windows to reload fonts and set 'MesloLGS NF Regular' as default font"
echo "- log out of your session and login again"
echo
case "$1" in
*) install ;;
esac