Skip to content

Instantly share code, notes, and snippets.

@Asherpayn
Created December 27, 2025 23:08
Show Gist options
  • Select an option

  • Save Asherpayn/76bd5ac0541700b39d64efc1f405e90a to your computer and use it in GitHub Desktop.

Select an option

Save Asherpayn/76bd5ac0541700b39d64efc1f405e90a to your computer and use it in GitHub Desktop.
this is info for claude to rebuild my preferred shell on other systems (macOS Arch Fedora)

Zsh Configuration Setup Prompt

Use this prompt with Claude Code to recreate my zsh configuration on a new system.


Task

Set up a complete zsh environment with Oh My Zsh, Powerlevel10k theme, and my preferred plugins/utilities. Detect the current OS and use the appropriate package manager.

Target Configuration

  • Shell: zsh with Oh My Zsh framework
  • Theme: Powerlevel10k
  • Plugins: git, zsh-syntax-highlighting, zsh-autosuggestions, zsh-history-substring-search
  • Utilities: fzf, lsd, thefuck, neofetch, yt-dlp, ffmpeg

GitHub Repositories (Verified)

Component Repository
Oh My Zsh https://github.com/ohmyzsh/ohmyzsh
Powerlevel10k https://github.com/romkatv/powerlevel10k
zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting
zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions
zsh-history-substring-search https://github.com/zsh-users/zsh-history-substring-search
fzf https://github.com/junegunn/fzf
lsd https://github.com/lsd-rs/lsd
thefuck https://github.com/nvbn/thefuck

Installation Steps by OS

macOS (Homebrew)

# Install dependencies
brew install zsh zsh-syntax-highlighting zsh-autosuggestions zsh-history-substring-search
brew install fzf lsd thefuck neofetch ffmpeg yt-dlp
brew install romkatv/powerlevel10k/powerlevel10k

# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Clone Powerlevel10k to Oh My Zsh custom themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

# Clone plugins to Oh My Zsh custom plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

# Set up fzf keybindings
$(brew --prefix)/opt/fzf/install --key-bindings --completion --no-update-rc

Arch Linux (pacman/yay)

# Install from official repos
sudo pacman -S zsh fzf lsd neofetch ffmpeg yt-dlp python-pip

# Install from AUR (using yay)
yay -S --noconfirm zsh-theme-powerlevel10k-git oh-my-zsh-git thefuck

# Alternative: Install thefuck via pip if AUR version has issues
pip install thefuck --user --break-system-packages

# Install Oh My Zsh (if not using AUR package)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Clone plugins to Oh My Zsh custom plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

# Clone Powerlevel10k (if not using AUR package)
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Fedora (dnf)

# Install from official repos
sudo dnf install zsh fzf util-linux-user neofetch ffmpeg yt-dlp python3-pip

# Install lsd (Fedora 33+)
sudo dnf install lsd

# Alternative: Install lsd from cargo if not in repos
# cargo install lsd

# Install thefuck via pip
pip install thefuck --user

# Install Oh My Zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Clone Powerlevel10k
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

# Clone plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-history-substring-search.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

# Set zsh as default shell
chsh -s $(which zsh)

Zshrc Configuration

Write the following to ~/.zshrc:

# Run neofetch on terminal open
eval neofetch

# Enable Powerlevel10k instant prompt (keep near top)
typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet
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

# Oh My Zsh configuration
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"

# Oh My Zsh settings
COMPLETION_WAITING_DOTS="true"
ENABLE_CORRECTION="true"
zstyle ':omz:update' mode reminder

# Plugins (loaded via Oh My Zsh)
plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
  zsh-history-substring-search
)

source $ZSH/oh-my-zsh.sh

# ══════════════════════════════════════════════════════════════════════════════
# ALIASES
# ══════════════════════════════════════════════════════════════════════════════

# lsd replacements for ls
alias ls="lsd"
alias lstree='lsd --tree'

# yt-dlp shortcuts
alias bestyt='yt-dlp -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]" --embed-subs --embed-metadata --embed-chapters --embed-thumbnail --merge-output-format mp4'
alias bestaudioyt='yt-dlp -f bestaudio --extract-audio --audio-format flac --add-metadata'

# ══════════════════════════════════════════════════════════════════════════════
# FUNCTIONS
# ══════════════════════════════════════════════════════════════════════════════

# Convert video to MP4 (software encoding - x264)
tomp4() {
  if [ -z "$1" ]; then
    echo "Usage: tomp4 <input> [output]"
    return 1
  fi
  local input="$1"
  local output="${2:-${input%.*}.mp4}"
  ffmpeg -i "$input" -c:v libx264 -preset slow -crf 20 -c:a aac -b:a 128k -movflags +faststart "$output"
}

# Extract audio to FLAC
extractaudio() {
  if [ -z "$1" ]; then
    printf 'Usage: extractaudio <input-file> [output-file] [track-index]\n'
    return 1
  fi
  local input="$1"
  local output="${2:-${input%.*}.flac}"
  local track_index="${3:-0}"
  ffmpeg -y -hide_banner -loglevel error -i "$input" -vn -map 0:a:$track_index -c:a flac "$output"
}

# ══════════════════════════════════════════════════════════════════════════════
# COMPLETION CONFIGURATION
# ══════════════════════════════════════════════════════════════════════════════

autoload -Uz compinit && compinit

# Colored completions
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu select
zstyle ':completion:*' rehash true
zstyle ':completion:*' verbose yes

# Case-insensitive and partial-word completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*' match-original both

# ══════════════════════════════════════════════════════════════════════════════
# COLOUR SCHEME (Pastel - optimized for dark backgrounds)
# ══════════════════════════════════════════════════════════════════════════════

export LS_COLORS="di=38;5;147:ln=38;5;213:ex=38;5;156:*.txt=38;5;228:*.md=38;5;225:*.sh=38;5;159:*.py=38;5;218:*.js=38;5;153:*.json=38;5;158:*.yaml=38;5;189:*.yml=38;5;189:*.html=38;5;217:*.css=38;5;159:*.rs=38;5;156:*.go=38;5;153:*.rb=38;5;218:*.java=38;5;228:*.cpp=38;5;147:*.c=38;5;147:*.h=38;5;189:*.zip=38;5;217:*.tar=38;5;217:*.gz=38;5;217:*.mp4=38;5;213:*.mp3=38;5;213:*.png=38;5;225:*.jpg=38;5;225:*.gif=38;5;225:*.pdf=38;5;228:*.db=38;5;159:*.sql=38;5;158:*.log=38;5;245:*.xml=38;5;189:*.csv=38;5;228:*.toml=38;5;189"

# ══════════════════════════════════════════════════════════════════════════════
# TOOL INTEGRATIONS
# ══════════════════════════════════════════════════════════════════════════════

# fzf integration
source <(fzf --zsh) 2>/dev/null || [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh

# thefuck integration
eval $(thefuck --alias)

# Powerlevel10k configuration
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

# ══════════════════════════════════════════════════════════════════════════════
# PATH EXTENSIONS (adjust paths per system)
# ══════════════════════════════════════════════════════════════════════════════

# Add local bin to PATH
export PATH="$HOME/.local/bin:$PATH"

# ══════════════════════════════════════════════════════════════════════════════
# OS-SPECIFIC CONFIGURATION
# ══════════════════════════════════════════════════════════════════════════════

case "$(uname -s)" in
  Darwin)
    # macOS-specific
    export PATH="/opt/homebrew/bin:$PATH"
    
    # Source Homebrew-installed plugins if Oh My Zsh plugins not found
    [[ -f /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && \
      source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
    [[ -f /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]] && \
      source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    [[ -f $(brew --prefix 2>/dev/null)/share/zsh-history-substring-search/zsh-history-substring-search.zsh ]] && \
      source $(brew --prefix)/share/zsh-history-substring-search/zsh-history-substring-search.zsh
    ;;
  Linux)
    # Linux-specific
    if command -v pacman &> /dev/null; then
      # Arch Linux - source from system paths if installed via pacman
      [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && \
        source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
      [[ -f /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]] && \
        source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
      # Powerlevel10k from AUR
      [[ -f /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme ]] && \
        source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
    fi
    ;;
esac

# ══════════════════════════════════════════════════════════════════════════════
# KEY BINDINGS (for history-substring-search)
# ══════════════════════════════════════════════════════════════════════════════

bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down

Post-Installation Steps

  1. Run Powerlevel10k configuration wizard:

    p10k configure

    This generates ~/.p10k.zsh with your preferred prompt style.

  2. Install a Nerd Font (required for icons in lsd and Powerlevel10k):

    • Download from: https://www.nerdfonts.com/font-downloads
    • Recommended: MesloLGS NF, FiraCode Nerd Font, or JetBrainsMono Nerd Font
    • macOS: Double-click downloaded .ttf files
    • Linux: Copy to ~/.local/share/fonts/ then run fc-cache -fv
  3. Configure terminal emulator to use the installed Nerd Font.

  4. Restart terminal or run exec zsh to apply changes.

Verification

Run these commands to verify installation:

# Check shell
echo $SHELL

# Check Oh My Zsh
ls ~/.oh-my-zsh

# Check theme
echo $ZSH_THEME

# Check plugins are loaded
zsh -i -c 'echo $plugins'

# Check utilities
command -v lsd fzf thefuck neofetch yt-dlp ffmpeg

Notes

  • The zshrc includes OS detection to source plugins from the correct paths
  • fzf integration uses the new --zsh flag (fzf 0.48+), with fallback for older versions
  • thefuck alias is set to fuck by default
  • History substring search binds to up/down arrow keys
  • Pastel colour scheme is optimized for dark terminal backgrounds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment