Skip to content

Instantly share code, notes, and snippets.

@Issaminu
Created September 10, 2026 19:19
Show Gist options
  • Select an option

  • Save Issaminu/35d8a87a3b4cc1ffee439fe1c1c3182e to your computer and use it in GitHub Desktop.

Select an option

Save Issaminu/35d8a87a3b4cc1ffee439fe1c1c3182e to your computer and use it in GitHub Desktop.
.zshrc - sanitized version
# ---- Powerlevel10k instant prompt (keep first) ----
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Skip heavy init for non-interactive shells (big speed win for scripts)
[[ $- != *i* ]] && return
# ---- History & options ----
HISTFILE=~/.histfile
HISTSIZE=10000
SAVEHIST=10000
setopt inc_append_history
setopt share_history
setopt histignorealldups
# ---- Editing niceties ----
autoload -Uz select-word-style
select-word-style bash
# ---- Completion styles (colors/menu) ----
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# ---- Add completion dirs BEFORE compinit (e.g., Docker) ----
# [[ -d "$HOME/.docker/completions" ]] && fpath=("$HOME/.docker/completions" $fpath)
# ---- Completions (run ONCE, with cache) ----
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$HOME/.zcompcache"
autoload -Uz compinit
compinit -d "$HOME/.zcompdump-$HOST"
# If you truly need bash-style completions, uncomment:
# autoload -Uz bashcompinit
# bashcompinit
# ---- One-time bootstrap for theme/plugins ----
[[ -d "$HOME/.zsh" ]] || {
echo "Creating $HOME/.zsh"
mkdir -p "$HOME/.zsh"
}
[[ -d "$HOME/.zsh/powerlevel10k" ]] || {
echo "Installing powerlevel10k theme."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "$HOME/.zsh/powerlevel10k"
}
[[ -d "$HOME/.zsh/zsh-autosuggestions" ]] || {
echo "Installing zsh autosuggestions."
git clone https://github.com/zsh-users/zsh-autosuggestions "$HOME/.zsh/zsh-autosuggestions"
}
[[ -d "$HOME/.zsh/zsh-syntax-highlighting" ]] || {
echo "Installing zsh syntax highlighting."
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.zsh/zsh-syntax-highlighting"
}
[[ -d "$HOME/.zsh/zsh-history-substring-search" ]] || {
echo "Installing zsh history substring search."
git clone https://github.com/zsh-users/zsh-history-substring-search.git "$HOME/.zsh/zsh-history-substring-search"
}
[[ -d "$HOME/.zsh/fzf-dir-navigator" ]] || {
echo "Installing fzf dir navigator."
git clone https://github.com/KulkarniKaustubh/fzf-dir-navigator.git "$HOME/.zsh/fzf-dir-navigator"
}
# ---- Theme & plugin load order ----
source "$HOME/.zsh/powerlevel10k/powerlevel10k.zsh-theme"
[[ -f "$HOME/.p10k.zsh" ]] && source "$HOME/.p10k.zsh"
source "$HOME/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh"
source "$HOME/.zsh/zsh-history-substring-search/zsh-history-substring-search.zsh"
source "$HOME/.zsh/fzf-dir-navigator/fzf-dir-navigator.zsh"
[[ -f "$HOME/.fzf.zsh" ]] && source "$HOME/.fzf.zsh"
# ---- Keybinds ----
bindkey "^[[A" history-substring-search-up
bindkey "^[[B" history-substring-search-down
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char
if command -v nvim &>/dev/null; then
bindkey -s "^[e" "nvim .; ^M"
fi
if command -v nautilus &>/dev/null; then
bindkey -s "^[n" "nautilus . &; disown %1; ^M"
fi
# ---- command-not-found helper ----
command_not_found_handler() {
if [[ -x /usr/lib/command-not-found ]]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [[ -x /usr/share/command-not-found/command-not-found ]]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
# ---- Emacs TRAMP friendliness for dumb terminals ----
if [[ "$TERM" == "dumb" ]]; then
unsetopt zle
unsetopt prompt_cr
unsetopt prompt_subst
unfunction precmd 2>/dev/null
unfunction preexec 2>/dev/null
PS1='$ '
fi
# ---- Source any per-user alias files ----
for f in ~/.aliases*.zsh(N); do
source "$f"
done
# ---- Optional: ROS setup ----
# source /opt/ros/noetic/setup.zsh
# ---- Bun completions ----
[[ -s "$HOME/.bun/_bun" ]] && source "$HOME/.bun/_bun"
# ---- Env vars / PATH ----
export BUN_INSTALL="$HOME/.bun"
export RUST_INSTALL="$HOME/.cargo"
export ANDROID_HOME="$HOME/Android/Sdk"
# export DOCKER_HOST="unix://$HOME/.docker/run/docker.sock"
# PNPM home
export PNPM_HOME="$HOME/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# Core PATH stack
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$HOME/.cargo/bin:$HOME/.bun/bin:$HOME/.local/bin:/usr/local/cuda/bin:/opt/cuda/bin:$HOME/go/go1.23.4/bin:$HOME/go/bin:$PATH"
export PATH="$PATH:$HOME/.lmstudio/bin"
# ---- Package managers ----
alias dnfi="sudo dnf install"
alias dnfu="sudo dnf update"
alias dnfur="sudo dnf update --refresh"
alias dnfr="sudo dnf remove"
alias bunu="bun upgrade && pnpm self-update"
alias uvu="uv self update"
alias brewu="brew update && brew upgrade"
alias neofetch="fastfetch"
# ---- Navigation ----
alias cdd="cd ~/Desktop"
alias cddd="cd ~/Downloads"
alias cdp="cd ~/Projects"
# ---- Local helper scripts ----
alias auto="$HOME/Applications/autoclean_edge.sh"
alias gou="$HOME/Applications/update_golang.sh"
# ---- GitHub Copilot ----
alias cs='gh copilot suggest'
alias ce='gh copilot explain'
# ---- Development ----
alias brd="pnpm run dev"
alias brdt="bun run dev --turbo"
alias c.="code ."
alias c="code ."
alias pipv="uv pip"
alias pipuv="uv pip"
alias uvpip="uv pip"
alias zshrc="code ~/.zshrc"
alias szshrc="source ~/.zshrc"
alias szsh="source ~/.zshrc"
alias python="python3"
alias pip="python -m pip"
alias start="make start"
alias venv="source .venv/bin/activate"
alias uvs="venv && uv sync --active --all-groups"
# ---- Applications ----
alias packettracer="export XDG_CONFIG_HOME=~/.configPT; firejail --net=none packettracer"
alias differ="open -a 'Medio'"
# ---- Zen Browser updates ----
# WARNING: These execute a remote script directly.
alias zu='echo 1 | bash <(curl https://updates.zen-browser.app/appimage.sh)'
alias ztu='echo 1 | bash <(curl https://updates.zen-browser.app/appimage.sh) twilight'
alias zutu='echo 1 | bash <(curl https://updates.zen-browser.app/appimage.sh) twilight'
# ---- Git ----
alias g='git'
alias ga='git add'
alias gb='git branch'
alias gcm='git checkout main'
alias gcb='git checkout -b'
alias gs='git stash'
alias gsp='git stash pop'
# Push the current branch to origin.
gp() {
git push origin "$(git rev-parse --abbrev-ref HEAD)"
}
# ---- GitHub account switching ----
# Account-specific usernames, names, and emails are intentionally kept
# outside this public file in ~/.zsh-private.
#
# ~/.zsh-private can contain variables such as:
#
# export GH_PERSONAL_USER="..."
# export GH_PERSONAL_NAME="..."
# export GH_PERSONAL_EMAIL="..."
# export GH_WORK_USER="..."
# export GH_WORK_NAME="..."
# export GH_WORK_EMAIL="..."
[[ -f "$HOME/.zsh-private" ]] && source "$HOME/.zsh-private"
ghswitch() {
local target="$1"
if [[ -z "$target" ]]; then
gh auth switch >/dev/null || return $?
else
gh auth switch -u "$target" >/dev/null || return $?
fi
local active
active=$(gh api user --jq .login 2>/dev/null)
if [[ -z "$active" ]]; then
echo "ghswitch: could not determine active gh account" >&2
return 1
fi
local name email
case "$active" in
"$GH_PERSONAL_USER")
name="$GH_PERSONAL_NAME"
email="$GH_PERSONAL_EMAIL"
;;
"$GH_WORK_USER")
name="$GH_WORK_NAME"
email="$GH_WORK_EMAIL"
;;
*)
echo "ghswitch: no git identity mapped for account '$active'" >&2
return 1
;;
esac
git config --global user.name "$name"
git config --global user.email "$email"
echo "Switched -> gh: $active | git: $name <$email>"
}
alias gitswitch=ghswitch
# ---- pnpm / Bun ----
alias pn="pnpm"
alias pnu="pnpm self-update"
alias pni="pnpm install"
alias buni="bun install"
alias pnpmu="pnpm self-update"
# ---- Kill common development ports ----
alias 4000="lsof -ti tcp:4000 | xargs -r kill -9"
alias 5432="lsof -ti tcp:5432 | xargs -r kill -9"
# ---- Misc ----
alias makefile="cp -f '$HOME/.Makefile' './Makefile'"
alias claudeu="claude update"
# ---- Local environment loader ----
[[ -f "$HOME/.local/bin/env" ]] && source "$HOME/.local/bin/env"
# ---- AWS / work-specific configuration ----
# Organization-specific AWS profiles, project names, log groups,
# runtime IDs, regions, and other infrastructure details should go
# in ~/.zsh-private rather than this public file.
# ---- Syntax highlighting (load LAST) ----
[[ -f "$HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]] && \
source "$HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment