-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.zshrc
More file actions
126 lines (107 loc) · 4.43 KB
/
Copy path.zshrc
File metadata and controls
126 lines (107 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# ===============================================
# .zshrc - Interactive shell configuration
# ===============================================
# Performance profiling (uncomment to debug slow startup)
# zmodload zsh/zprof
# Oh My Zsh configuration (must come before sourcing oh-my-zsh)
ZSH_THEME="" # Disabled — Starship handles the prompt
ZSH_DISABLE_COMPFIX="true"
UPDATE_ZSH_DAYS=30
DISABLE_AUTO_UPDATE="true"
ENABLE_CORRECTION="false"
COMPLETION_WAITING_DOTS="true"
DISABLE_UNTRACKED_FILES_DIRTY="true" # Speed up git status in large repos
# Oh My Zsh plugins (minimal for better performance)
plugins=(
git
docker-compose
kubectl
)
# Source modular configuration files
DOTFILES_ROOT="${DOTFILES_ROOT:-$HOME/dotfiles}"
# Set up completion paths BEFORE Oh My Zsh (which calls compinit internally).
# fpath entries must be in place before compinit scans them.
fpath=(
$HOME/.zsh/completions(N)
$HOME/.docker/completions(N)
$fpath
)
if [[ -n "$HOMEBREW_PREFIX" ]]; then
fpath=(
$HOMEBREW_PREFIX/share/zsh/site-functions(N)
$HOMEBREW_PREFIX/share/zsh-completions(N)
$fpath
)
fi
# Source Oh My Zsh (handles compinit with all fpath entries above)
[[ -f "$ZSH/oh-my-zsh.sh" ]] && source "$ZSH/oh-my-zsh.sh"
# Load configuration modules
[[ -f "$DOTFILES_ROOT/.completion" ]] && source "$DOTFILES_ROOT/.completion"
[[ -f "$DOTFILES_ROOT/.aliases" ]] && source "$DOTFILES_ROOT/.aliases"
[[ -f "$DOTFILES_ROOT/.functions" ]] && source "$DOTFILES_ROOT/.functions"
[[ -f "$DOTFILES_ROOT/.ssh-agent" ]] && source "$DOTFILES_ROOT/.ssh-agent"
# Load Homebrew shell integrations
if [[ -n "$HOMEBREW_PREFIX" ]]; then
# Zsh autosuggestions
[[ -f "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ]] && \
source "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
# Zsh syntax highlighting (load last among plugins)
[[ -f "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]] && \
source "$HOMEBREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
fi
# Starship prompt (if installed)
if command -v starship &> /dev/null; then
eval "$(starship init zsh)"
fi
# Load NVM (Node Version Manager)
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
if [[ -n "$HOMEBREW_PREFIX" && -s "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" ]]; then
source "$HOMEBREW_PREFIX/opt/nvm/nvm.sh"
elif [[ -s "$NVM_DIR/nvm.sh" ]]; then
source "$NVM_DIR/nvm.sh"
fi
# Load local/private configuration (not tracked in git)
[[ -f "$HOME/.zshrc.local" ]] && source "$HOME/.zshrc.local"
# History configuration
HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=50000
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits
setopt SHARE_HISTORY # Share history between all sessions
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate
setopt HIST_FIND_NO_DUPS # Do not display a previously found event
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space
setopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file
setopt HIST_VERIFY # Do not execute immediately upon history expansion
# Key bindings
bindkey -e # Use emacs key bindings
bindkey '^[[A' history-search-backward
bindkey '^[[B' history-search-forward
# Claude Code wrapper — reset kitty keyboard protocol on exit
# Prevents leftover escape sequences (e.g. '9;5u' on Ctrl+C)
claude() {
command claude "$@"
local exit_code=$?
printf '\e[>0u'
return $exit_code
}
# Fix extra characters when pasting (bracketed paste)
if [[ $TERM != "dumb" ]]; then
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
zstyle ':bracketed-paste-magic' active-widgets '.self-*'
else
# Disable bracketed paste for dumb terminals
unset zle_bracketed_paste
fi
# Python (version matches .brewfile)
if [[ -n "$HOMEBREW_PREFIX" && -d "$HOMEBREW_PREFIX/opt/python@3.13/libexec/bin" ]]; then
export PATH="$HOMEBREW_PREFIX/opt/python@3.13/libexec/bin:$PATH"
fi
# Deduplicate PATH entries
typeset -U path
# Performance profiling (uncomment to see results)
# zprof