Last active
May 25, 2026 12:58
-
-
Save walkerjeffd/c4012ba493917d5c5485c3696c8c16c4 to your computer and use it in GitHub Desktop.
Zsh Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ---------------------------------------------------------------------------- | |
| # PATH | |
| # ---------------------------------------------------------------------------- | |
| export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH | |
| # ---------------------------------------------------------------------------- | |
| # oh-my-zsh | |
| # ---------------------------------------------------------------------------- | |
| export ZSH="$HOME/.oh-my-zsh" | |
| ZSH_THEME="" # use starship instead | |
| plugins=( | |
| git | |
| zsh-syntax-highlighting | |
| zsh-autosuggestions | |
| ) | |
| # Disable auto-update prompt; run `omz update` manually when you want it | |
| zstyle ':omz:update' mode disabled | |
| source "$ZSH/oh-my-zsh.sh" | |
| # ---------------------------------------------------------------------------- | |
| # History (set AFTER oh-my-zsh) | |
| # ---------------------------------------------------------------------------- | |
| HISTFILE="$HOME/.zsh_history" | |
| HISTSIZE=50000 | |
| SAVEHIST=50000 | |
| setopt EXTENDED_HISTORY # timestamps in history file | |
| setopt HIST_EXPIRE_DUPS_FIRST # trim dupes first when HISTSIZE is hit | |
| setopt HIST_IGNORE_DUPS # don't record consecutive dupes | |
| setopt HIST_IGNORE_ALL_DUPS # remove older dupe when adding new | |
| setopt HIST_IGNORE_SPACE # don't record commands starting with space | |
| setopt HIST_REDUCE_BLANKS # strip extra whitespace | |
| setopt HIST_VERIFY # !! expansion edits, doesn't auto-run | |
| setopt SHARE_HISTORY # share history between sessions | |
| setopt INC_APPEND_HISTORY # write immediately, not on shell exit | |
| # ---------------------------------------------------------------------------- | |
| # Shell options | |
| # ---------------------------------------------------------------------------- | |
| setopt AUTO_CD # type a dir name to cd into it | |
| setopt AUTO_PUSHD # cd pushes onto the dir stack | |
| setopt PUSHD_IGNORE_DUPS | |
| # setopt CORRECT # suggest corrections for typos | |
| setopt INTERACTIVE_COMMENTS # allow # comments at the prompt | |
| # Completion polish | |
| zstyle ':completion:*' menu select # arrow-key menu | |
| zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # case-insensitive | |
| zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # use the same colors as ls | |
| # ---------------------------------------------------------------------------- | |
| # Environment | |
| # ---------------------------------------------------------------------------- | |
| export EDITOR='nano' # change to nano / nvim / 'code --wait' if preferred | |
| export VISUAL="$EDITOR" | |
| export PAGER='less' | |
| export LESS='-R -F -X' # color, quit-if-one-screen, no alt-screen | |
| export LANG='en_US.UTF-8' | |
| # ---------------------------------------------------------------------------- | |
| # Modern CLI replacements | |
| # ---------------------------------------------------------------------------- | |
| alias grep='grep --color=auto' | |
| # ---------------------------------------------------------------------------- | |
| # direnv — per-directory env vars (drop a .envrc in any project) | |
| # ---------------------------------------------------------------------------- | |
| if command -v direnv >/dev/null 2>&1; then | |
| eval "$(direnv hook zsh)" | |
| fi | |
| # ---------------------------------------------------------------------------- | |
| # Python (uv) | |
| # ---------------------------------------------------------------------------- | |
| if command -v uv >/dev/null 2>&1; then | |
| eval "$(uv generate-shell-completion zsh)" | |
| fi | |
| # ---------------------------------------------------------------------------- | |
| # Git aliases | |
| # ---------------------------------------------------------------------------- | |
| alias gs='git status -sb' | |
| alias gd='git diff' | |
| alias gds='git diff --staged' | |
| alias gl='git log --oneline --graph --decorate -20' | |
| alias gla='git log --oneline --graph --decorate --all -30' | |
| alias gco='git checkout' | |
| alias gcb='git checkout -b' | |
| alias gp='git push' | |
| alias gpu='git pull' | |
| alias gaa='git add --all' | |
| alias gcm='git commit -m' | |
| # ---------------------------------------------------------------------------- | |
| # Docker | |
| # ---------------------------------------------------------------------------- | |
| alias d='docker' | |
| alias dc='docker compose' | |
| alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"' | |
| alias dlogs='docker compose logs -f --tail=100' | |
| alias dprune='docker system prune -af --volumes' | |
| # ---------------------------------------------------------------------------- | |
| # WSL2 — only loaded when running inside WSL | |
| # ---------------------------------------------------------------------------- | |
| if grep -qi microsoft /proc/version 2>/dev/null; then | |
| export BROWSER="/mnt/c/Windows/explorer.exe" | |
| alias open='explorer.exe' | |
| alias explorer='explorer.exe .' | |
| alias pbcopy='clip.exe' | |
| alias pbpaste='powershell.exe -command "Get-Clipboard" | tr -d "\r"' | |
| alias winhome='cd /mnt/c/Users/$(whoami)' | |
| alias wpath='wslpath -w' # WSL path -> Windows path | |
| alias upath='wslpath -u' # Windows path -> WSL path | |
| fi | |
| # ---------------------------------------------------------------------------- | |
| # Functions | |
| # ---------------------------------------------------------------------------- | |
| # mkdir + cd in one go | |
| mkcd() { mkdir -p "$1" && cd "$1"; } | |
| # universal archive extractor | |
| extract() { | |
| if [ ! -f "$1" ]; then | |
| echo "'$1' is not a valid file" | |
| return 1 | |
| fi | |
| case "$1" in | |
| *.tar.bz2|*.tbz2) tar xjf "$1" ;; | |
| *.tar.gz|*.tgz) tar xzf "$1" ;; | |
| *.tar.xz) tar xJf "$1" ;; | |
| *.tar) tar xf "$1" ;; | |
| *.zip) unzip "$1" ;; | |
| *.gz) gunzip "$1" ;; | |
| *.bz2) bunzip2 "$1" ;; | |
| *.7z) 7z x "$1" ;; | |
| *.rar) unrar x "$1" ;; | |
| *) echo "Don't know how to extract '$1'" ;; | |
| esac | |
| } | |
| # quick HTTP server in the current dir (default port 8000) | |
| serve() { python3 -m http.server "${1:-8000}"; } | |
| # show what's listening on a port | |
| port() { ss -tulpn | grep ":${1:-}"; } | |
| # ---------------------------------------------------------------------------- | |
| # Local overrides | |
| # ---------------------------------------------------------------------------- | |
| [ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local" | |
| # ---------------------------------------------------------------------------- | |
| # Prompt (starship) — must be last so nothing overrides it | |
| # ---------------------------------------------------------------------------- | |
| if command -v starship >/dev/null 2>&1; then | |
| eval "$(starship init zsh)" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #bin/bash | |
| # install zsh and main deds | |
| sudo apt update && sudo apt install -y zsh git curl build-essential | |
| # oh-my-zsh | |
| sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
| # omz plugins | |
| git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
| git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
| # starship | |
| curl -sS https://starship.rs/install.sh | sh | |
| mkdir -p ~/.config | |
| starship preset plain-text-symbols -o ~/.config/starship.toml | |
| # set default shell | |
| chsh -s $(which zsh) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment