Skip to content

Instantly share code, notes, and snippets.

@themagicalmammal
Last active February 9, 2026 09:27
Show Gist options
  • Select an option

  • Save themagicalmammal/ead5fe3305f63ddfd871c80388cd98b8 to your computer and use it in GitHub Desktop.

Select an option

Save themagicalmammal/ead5fe3305f63ddfd871c80388cd98b8 to your computer and use it in GitHub Desktop.
My Zsh (On my Void Setup - void musl x86_64)
[[ -z "$ZSH_VERSION" ]] && return
############################
# PATH & ENVIRONMENT
############################
# Path handling (zsh-native, no duplicates)
path=(
$HOME/.local/bin
$HOME/.cargo/bin
$path
)
export EDITOR="nano"
############################
# PROMPT & WINDOW TITLE
############################
eval "$(starship init zsh)"
autoload -Uz add-zsh-hook
set_win_title() {
echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007"
}
add-zsh-hook precmd set_win_title
############################
# PLUGINS
############################
# Syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Autosuggestions
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# History substring search
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
# fzf
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh
# Arch Linux command-not-found
[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] \
&& source /usr/share/doc/pkgfile/command-not-found.zsh
# Advanced command-not-found
[[ -e /usr/share/doc/find-the-command/ftc.zsh ]] \
&& source /usr/share/doc/find-the-command/ftc.zsh
############################
# OPTIONS
############################
setopt extendedglob
setopt nocaseglob
setopt rcexpandparam
setopt nocheckjobs
setopt numericglobsort
setopt nobeep
setopt appendhistory
setopt histignorealldups
setopt autocd
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
# Spell correction (comment out if annoying)
setopt correct
############################
# COMPLETION
############################
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' rehash true
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' completer _expand _complete _ignored _approximate
zstyle ':completion:*' menu select
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u'
zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.cache/zcache
autoload -U +X bashcompinit && bashcompinit
############################
# HISTORY
############################
HISTFILE=~/.zhistory
HISTSIZE=50000
SAVEHIST=10000
############################
# KEY BINDINGS
############################
bindkey -e
# PageUp / PageDown history
[[ -n "${terminfo[kpp]}" ]] && bindkey "${terminfo[kpp]}" up-line-or-history
[[ -n "${terminfo[knp]}" ]] && bindkey "${terminfo[knp]}" down-line-or-history
# Arrow fuzzy search
autoload -U up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
[[ -n "${terminfo[kcuu1]}" ]] && bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
[[ -n "${terminfo[kcud1]}" ]] && bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
# Home / End
[[ -n "${terminfo[khome]}" ]] && bindkey "${terminfo[khome]}" beginning-of-line
[[ -n "${terminfo[kend]}" ]] && bindkey "${terminfo[kend]}" end-of-line
# Shift-Tab
[[ -n "${terminfo[kcbt]}" ]] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
# Backspace / Delete
bindkey '^?' backward-delete-char
[[ -n "${terminfo[kdch1]}" ]] && bindkey "${terminfo[kdch1]}" delete-char
# Application mode fix
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
zle_application_mode_start() { echoti smkx }
zle_application_mode_stop() { echoti rmkx }
add-zle-hook-widget zle-line-init zle_application_mode_start
add-zle-hook-widget zle-line-finish zle_application_mode_stop
fi
############################
# ALIASES
############################
# Core
alias _='sudo'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
# Safer overrides
alias ls='lsd --group-dirs first'
alias lt='lsd --tree'
alias top='htop'
# cat only interactive
[[ -o interactive ]] && alias cat='bat --pager=never --theme=ansi'
alias catf='bat --theme=ansi'
alias ccat='/bin/cat'
# Grep & diff
alias grep='grep --color=auto'
alias diff='diff --color=auto'
# System
alias halt='sudo halt'
alias poweroff='sudo poweroff'
alias reboot='sudo reboot'
alias shutdown='sudo shutdown'
alias zzz='sudo zzz'
############################
# PACKAGE MANAGERS
############################
# XBPS
alias xu='sudo xbps-install -Suv'
alias xr='sudo xbps-remove -Rcon'
alias xfr='sudo xbps-remove -Rcon -F'
alias xl='xbps-query -l'
alias xf='xl | grep'
alias xs='xbps-query -Rs'
alias xd='xbps-query -x'
alias xc='sudo xbps-remove -oO'
# Flatpak
alias flu='flatpak update'
alias fli='flatpak install'
alias flf='flatpak repair'
alias fls='flatpak search'
alias fll='flatpak list'
alias flr='flatpak uninstall --delete-data -y'
alias flc='flatpak uninstall --unused -y'
############################
# SPECIALS
############################
alias b='bleachbit'
alias be='_ bleachbit'
alias fre='sudo fc-cache -f -v && fc-cache -f -v'
alias u='xu && flu'
alias code='flatpak run com.visualstudio.code'
alias neofetch='fastfetch'
alias fetch='fastfetch'
alias clean='xc && flr && flc'
@themagicalmammal
Copy link
Author

themagicalmammal commented Feb 15, 2022

Requirements

  1. lsd
  2. zsh-autosuggestions
  3. zsh-history-substring-search
  4. zsh-syntax-highlighting
  5. fzf
  6. starship
  7. bat
  8. fastfetch

Also you need my starship config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment