zsh
Install
- Arch Linux
- Debian
sudo pacman -S zsh git curl fontconfig
sudo apt install -y zsh git curl fontconfig
chsh -s $(which zsh)
Log out and log back in after changing the default shell.
Oh My Zsh
Install Oh My Zsh after zsh, git, and curl are available.
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
The installer renames an existing ~/.zshrc to ~/.zshrc.pre-oh-my-zsh. Move any local settings that should be preserved into the new ~/.zshrc.
Font
Install D2Coding Nerd Font, then configure the terminal emulator to use D2CodingLigature Nerd Font or D2Coding Nerd Font.
- Arch Linux
- Debian
sudo pacman -S ttf-d2coding-nerd
sudo mkdir -p /usr/share/fonts/NerdFonts
curl -sL https://github.com/ryanoasis/nerd-fonts/releases/latest/download/D2Coding.tar.xz \
| sudo tar -xvJf - -C /usr/share/fonts/NerdFonts \
&& sudo fc-cache -fv
Theme
Install Powerlevel10k under the Oh My Zsh custom theme directory.
ZSH_CUSTOM=${ZSH_CUSTOM:-${ZSH:-$HOME/.oh-my-zsh}/custom} \
&& mkdir -p "$ZSH_CUSTOM/themes" \
&& git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$ZSH_CUSTOM/themes/powerlevel10k"
Run the configuration wizard after updating ~/.zshrc below and starting zsh.
p10k configure
Plugins
Install additional zsh-users plugins under the Oh My Zsh custom plugin directory.
ZSH_CUSTOM=${ZSH_CUSTOM:-${ZSH:-$HOME/.oh-my-zsh}/custom} \
&& mkdir -p "$ZSH_CUSTOM/plugins" \
&& git clone https://github.com/zsh-users/zsh-completions.git "$ZSH_CUSTOM/plugins/zsh-completions" \
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$ZSH_CUSTOM/plugins/zsh-syntax-highlighting" \
&& git clone https://github.com/zsh-users/zsh-autosuggestions.git "$ZSH_CUSTOM/plugins/zsh-autosuggestions"
.zshrc
~/.zshrc
is_installed() {
[ -n "$(command -v "$1" 2>/dev/null)" ]
}
# Oh My Zsh
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Add zsh-completions before Oh My Zsh initializes completion.
ZSH_CUSTOM=${ZSH_CUSTOM:-$ZSH/custom}
fpath+=$ZSH_CUSTOM/plugins/zsh-completions/src
autoload -Uz compinit && compinit
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
source "$ZSH/oh-my-zsh.sh"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
export PATH=$PATH:$HOME/.local/bin
######################
# User configuration #
######################
# git
git_remove_local_branch () {
git remote update --prune \
&& git switch --detach origin/HEAD \
&& git for-each-ref --format '%(refname:short)' refs/heads | xargs -r -t git branch -D \
&& git switch main
}