My ZSHRC File

Thursday, Jun 11, 2026

Here's the .zshrc file for my Mac

This file I keep working on and plan to add some some functions and aliases.

SAVEHIST=9000
HISTSIZE=9999
setopt EXTENDED_HISTORY
setopt HIST_IGNORE_DUPS

export VISUAL=nvim
export EDITOR="$VISUAL"

export DISABLE_AUTO_TITLE="true"

export pager=""

export PATH="$PATH:/usr/local/sbin"

export PATH="/opt/homebrew/opt:$PATH"

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - zsh)"

pyenv shell 3.14

export PATH="$PATH:$HOME/.emacs.d/bin"

git_branch () {
    git branch 2> /dev/null |sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

set_term_title() {
    print -Pn "\e]0;%2~\a"
}

autoload -Uz vcs_info
precmd() {
    vcs_info
    set_term_title
}

zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' unstagedstr ' *'
zstyle ':vcs_info:git:*' stagedstr ' +'
zstyle ':vcs_info:git:*' formats ' (%F{yellow}%b%u%c)'
zstyle ':vcs_info:git:*' actionformats ' (%F{yellow}%b|%F{red}%a%f%c%u)'

setopt PROMPT_SUBST
PROMPT='%F{184}%D{%d %B %Y %A %H:%M:%S %Z}%f %F{green}%n@%m%f:%F{169}%(4~|%-1~/.../%2~|%~)%f %F{red}${vcs_info_msg_0_}%f$ '

I ran in to a weird problem once where I accidentally pasted in the wrong kind of spaces. I fixed it by deleting them and readding the spaces, I'm not really sure what the issue was with them.