Zsh and omz as pack (updated)

This commit is contained in:
Anthony Axenov 2022-07-05 10:50:35 +08:00
parent 3fa1a4d09d
commit bcb1111a0a
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
3 changed files with 54 additions and 48 deletions

49
install/omz-clean Executable file
View File

@ -0,0 +1,49 @@
#!/bin/bash
##makedesc: Install omz (latest) + powerline10k + MesloLGS fonts
echo
echo "==============================================="
echo "Installing omz (latest) + powerline10k + MesloLGS fonts..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed zsh || ! installed git || ! installed curl; then
echo "ERROR: you need git, zsh and curl to be installed!"
exit 1
fi
echo
echo "1. Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo
echo "2. Installing MesloLGS fonts..."
mkdir -p ~/.local/share/fonts/
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf -O "~/.local/share/fonts/MesloLGS NF Regular.ttf"
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf -O "~/.local/share/fonts/MesloLGS NF Bold.ttf"
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf -O "~/.local/share/fonts/MesloLGS NF Italic.ttf"
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf -O "~/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
fc-cache -vf ~/.local/share/fonts/
echo
echo "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' ~/.zshrc
echo
echo "4. 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=/g' ~/.zshrc
echo "plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)" >> ~/.zshrc
p10k configure
echo
echo "Finish! You need to:"
echo "- review your plugins in ~/.zshrc"
echo "- log out of your session and login again"
echo

View File

@ -1,56 +1,11 @@
#!/bin/bash
##makedesc: Install zsh + omz (latest)
##makedesc: Install vanilla zsh
echo
echo "==============================================="
echo "Installing zsh + omz (latest)..."
echo "Installing vanilla zsh..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed git || ! installed curl; then
echo "ERROR: you need git and curl to be installed!"
exit 1
fi
sudo apt install -y --autoremove zsh
# sudo chsh -s $(which zsh)
# 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/
echo
echo "1. Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo
echo "2. Installing powerlevel9k theme (legacy)..."
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
sed -i 's@^ZSH_THEME=.*$@ZSH_THEME="powerlevel9k/powerlevel9k"@g' ~/.zshrc
echo
echo "3. Installing powerline fonts..."
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mkdir -p ~/.local/share/fonts/
mv PowerlineSymbols.otf ~/.local/share/fonts/
fc-cache -vf ~/.local/share/fonts/
mkdir -p ~/.config/fontconfig/conf.d/
mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/
echo
echo "4. Installing autosuggestions and syntax highlighting..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git .oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git .oh-my-zsh/custom/plugins/zsh-syntax-highlighting
sed -i 's@plugins=(git)@plugins=(git zsh-autosuggestions zsh-syntax-highlighting)@g' ~/.zshrc
echo
echo "Finish! Log out of your session and login again."
echo
echo "source ~/.profile" >> ~/.zshrc

2
packs/omz Normal file
View File

@ -0,0 +1,2 @@
##omz: [PACK] zsh + omz + powerline10k + MesloLGS fonts
omz: zsh omz-clean