Skip to content

Instantly share code, notes, and snippets.

@mrnkr
Last active May 17, 2026 22:23
Show Gist options
  • Select an option

  • Save mrnkr/a1d6677924d1fca4abb37ea1b67dee2d to your computer and use it in GitHub Desktop.

Select an option

Save mrnkr/a1d6677924d1fca4abb37ea1b67dee2d to your computer and use it in GitHub Desktop.
My .zshrc
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
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
source ~/.fzf.zsh
source ~/.alias.zsh
# Enable startup timing with: ZSH_STARTUP_PROFILE=1 zsh -i -c exit
zmodload zsh/datetime 2>/dev/null
typeset -g __startup_t0="$EPOCHREALTIME"
typeset -g __startup_t_start="$__startup_t0"
__startup_timer_mark() {
[[ -n "$ZSH_STARTUP_PROFILE" ]] || return
local label="$1"
local now="$EPOCHREALTIME"
local elapsed_ms=$(( (now - __startup_t0) * 1000 ))
printf 'zsh-init %-28s %8.3f ms\n' "$label" "$elapsed_ms"
__startup_t0="$now"
}
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
__startup_timer_mark "oh-my-zsh"
export KUBECONFIG=~/.kube/config:~/.kube/config.remote
export LC_ALL=en_US.UTF-8
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && . "/opt/homebrew/opt/nvm/nvm.sh"
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && . "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
# Keep default nvm behavior on shell startup.
if command -v nvm >/dev/null 2>&1; then
nvm use --silent default >/dev/null 2>&1
fi
# Auto-switch Node version when entering a directory that has an .nvmrc.
__find_nvmrc() {
local dir="$PWD"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/.nvmrc" ]]; then
printf '%s\n' "$dir/.nvmrc"
return 0
fi
dir="${dir:h}"
done
return 1
}
__nvm_auto_use() {
__find_nvmrc >/dev/null 2>&1 || return 0
command -v nvm >/dev/null 2>&1 && nvm use --silent >/dev/null 2>&1
}
autoload -Uz add-zsh-hook
add-zsh-hook chpwd __nvm_auto_use
__nvm_auto_use
__startup_timer_mark "nvm"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
__startup_timer_mark "powerlevel10k"
# pnpm
export PNPM_HOME="$HOME/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
[ -f "$HOME/.ghcup/env" ] && . "$HOME/.ghcup/env" # ghcup-env
__startup_timer_mark "ghcup"
# End of Docker CLI completions
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"
export PATH="/opt/homebrew/opt/python@3.14/libexec/bin:$PATH"
export PATH=/opt/homebrew/share/google-cloud-sdk/bin:"$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/opt/libpq/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libpq/lib/pkgconfig"
__load_rbenv() {
unset -f rbenv ruby gem bundle bundler rake irb
eval "$(rbenv init - zsh)"
}
rbenv() { __load_rbenv; rbenv "$@"; }
ruby() { __load_rbenv; ruby "$@"; }
gem() { __load_rbenv; gem "$@"; }
bundle() { __load_rbenv; bundle "$@"; }
bundler() { __load_rbenv; bundler "$@"; }
rake() { __load_rbenv; rake "$@"; }
irb() { __load_rbenv; irb "$@"; }
__find_ruby_version_file() {
local dir="$PWD"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/.ruby-version" ]]; then
printf '%s\n' "$dir/.ruby-version"
return 0
fi
dir="${dir:h}"
done
return 1
}
__rbenv_auto_use() {
local ruby_version_file
ruby_version_file="$(__find_ruby_version_file)" || return 0
__load_rbenv
local ruby_version
ruby_version="$(<"$ruby_version_file")"
[[ -n "$ruby_version" ]] || return 0
command -v rbenv >/dev/null 2>&1 && rbenv shell "$ruby_version" >/dev/null 2>&1
}
if [[ -o interactive ]]; then
autoload -Uz add-zsh-hook
add-zsh-hook chpwd __rbenv_auto_use
__rbenv_auto_use
fi
__startup_timer_mark "rbenv-lazy"
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
__load_pyenv() {
unset -f pyenv python python3 pip pip3
eval "$(pyenv init - zsh)"
}
pyenv() { __load_pyenv; pyenv "$@"; }
python() { __load_pyenv; python "$@"; }
python3() { __load_pyenv; python3 "$@"; }
pip() { __load_pyenv; pip "$@"; }
pip3() { __load_pyenv; pip3 "$@"; }
__startup_timer_mark "pyenv-lazy"
export PATH="/opt/homebrew/opt/postgresql@15/bin:$PATH"
if [[ -n "$ZSH_STARTUP_PROFILE" ]]; then
typeset total_ms=$(( (EPOCHREALTIME - __startup_t_start) * 1000 ))
printf 'zsh-init %-28s %8.3f ms\n' "total" "$total_ms"
fi
@mrnkr

mrnkr commented May 17, 2026

Copy link
Copy Markdown
Author

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