Last active
January 27, 2025 17:26
-
-
Save joshistoast/d625c8bb8b36ee12564d879bb33cc297 to your computer and use it in GitHub Desktop.
Personal zshrc config
This file contains 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
# 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 | |
# --------------- | |
# Paths | |
# --------------- | |
setopt extended_glob | |
typeset -gU path # Remove duplicates | |
export PNPM_HOME="$HOME/Library/pnpm" | |
path=( | |
$HOME/{,s}bin(N) | |
/opt/{homebrew,local}/{,s}bin(N) | |
/usr/{,local/}{,s}bin(N) | |
"$PNPM_HOME" | |
$path | |
) | |
# --------------- | |
# Configure Zinit | |
# --------------- | |
# Set directory for zinit to store zinit and plugins | |
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" | |
# Download zinit, if not already installed | |
if [ ! -d "$ZINIT_HOME" ]; then | |
mkdir -p "$(dirname $ZINIT_HOME)" | |
git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" | |
fi | |
# Source/Load zinit | |
source "$ZINIT_HOME/zinit.zsh" | |
# --------------- | |
# Load plugins | |
# --------------- | |
# Standard plugins | |
zinit ice depth=1 | |
zinit light romkatv/powerlevel10k | |
zinit light zsh-users/zsh-syntax-highlighting | |
zinit light zsh-users/zsh-completions | |
autoload -U compinit && compinit # Load Completions after zsh-completions | |
zinit light zsh-users/zsh-autosuggestions | |
zinit light Aloxaf/fzf-tab | |
# Snippets | |
zinit snippet OMZP::git | |
zinit snippet OMZP::sudo | |
zinit snippet OMZP::command-not-found | |
zinit snippet OMZP::nvm | |
zinit cdreplay -q | |
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. | |
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh | |
# History | |
HISTSIZE=5000 | |
HISTFILE=~/.zsh_history | |
SAVEHIST=$HISTSIZE | |
HISTDUP=erase | |
setopt appendhistory | |
setopt sharehistory | |
setopt hist_ignore_space | |
setopt hist_ignore_all_dups | |
setopt hist_save_no_dups | |
setopt hist_ignore_dups | |
setopt hist_find_no_dups | |
# Completion settings | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' | |
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" | |
zstyle ':completion:*' menu no | |
zstyle ':completion:*' list-max-items 20 | |
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath' | |
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'eza -1 --color=always $realpath' | |
zstyle ':fzf-tab:complete:git-(add|diff|restore):*' fzf-preview 'git diff $word | delta' | |
zstyle ':fzf-tab:*' switch-group '<' '>' | |
zstyle ':omzp:plugins:nvm' lazy yes | |
zstyle ':omzp:plugins:nvm' silent-autoload yes | |
# Aliases | |
alias ls='eza -1 --color' | |
alias zshconfig="code ~/.zshrc" | |
alias zshreload="source ~/.zshrc" | |
# Shell integrations | |
eval "$(fzf --zsh)" | |
eval "$(zoxide init --cmd cd zsh)" | |
# bun completions | |
[ -s "/Users/josh/.bun/_bun" ] && source "/Users/josh/.bun/_bun" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment