Skip to content

Instantly share code, notes, and snippets.

@AlexJuarez
Created June 26, 2025 10:33
Show Gist options
  • Select an option

  • Save AlexJuarez/abddd95bf98d77341dad6a1644e22884 to your computer and use it in GitHub Desktop.

Select an option

Save AlexJuarez/abddd95bf98d77341dad6a1644e22884 to your computer and use it in GitHub Desktop.
.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
# Performance optimizations
DISABLE_AUTO_UPDATE="true"
DISABLE_MAGIC_FUNCTIONS="true"
DISABLE_COMPFIX="true"
# Cache completions aggressively
autoload -Uz compinit
if [ "$(date +'%j')" != "$(stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)" ]; then
compinit
else
compinit -C
fi
# Oh My Zsh path
export ZSH="$HOME/.oh-my-zsh"
export PATH=$PATH:~/bin/
# Theme config
ZSH_THEME="powerlevel10k/powerlevel10k"
# Carefully ordered plugins (syntax highlighting must be last)
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
zsh-bat
)
# Source Oh My Zsh
source $ZSH/oh-my-zsh.sh
# Autosuggest settings
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="g=5"
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE="20"
ZSH_AUTOSUGGEST_USE_ASYNC=1
# Lazy load SSH agent
function _load_ssh_agent() {
if [ -z "$$SSH_AUTH_SOCK" ]; then
eval "$(ssh-agent -s)" > /dev/null
ssh-add ~/.ssh/id_github_sign_and_auth 2>/dev/null
fi
}
autoload -U add-zsh-hook
add-zsh-hook precmd _load_ssh_agent
# Source aliases last
[ -f ~/.zsh_aliases ] && source ~/.zsh_aliases
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment