-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
215 lines (180 loc) · 6.92 KB
/
zshrc
File metadata and controls
215 lines (180 loc) · 6.92 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Kiro CLI pre block. Keep at the top of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.pre.zsh"
# Amazon Q pre block (keep at top)
# PATH modifications (consolidated)
path=(
$HOME/.asdf/shims
/opt/homebrew/bin
/opt/homebrew/opt/python@3.10/libexec/bin
/Library/Frameworks/Python.framework/Versions/3.11/bin
/opt/homebrew/opt/openjdk@21/bin
$HOME/.babashka/bbin/bin
$HOME/.local/bin
$HOME/.pnpm
$HOME/.codeium/windsurf/bin
$HOME/.antigravity/antigravity/bin
$path
)
typeset -U path fpath
export PATH
# CDPATH for quick directory switching
cdpath=(~ ~/Dropbox/git)
# Directory hash shortcuts (~git)
hash -d git=~/Dropbox/git
# pnpm
export PNPM_HOME="$HOME/.pnpm"
# Oh My Zsh variables (must be set BEFORE sourcing oh-my-zsh)
COMPLETION_WAITING_DOTS="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Oh My Zsh setup
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="dracula"
plugins=(git gh zsh-fzf-history-search)
[[ -f $ZSH/oh-my-zsh.sh ]] && source $ZSH/oh-my-zsh.sh
# Locale settings
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
# Editor settings
export ALTERNATE_EDITOR=""
export EDITOR="emacsclient -c -a ''"
# Shell options
setopt extendedglob
unsetopt nomatch # Allow [ or ] anywhere
setopt NO_FLOW_CONTROL
setopt INTERACTIVE_COMMENTS
setopt AUTO_PUSHD PUSHD_IGNORE_DUPS PUSHD_SILENT
setopt CORRECT # Suggest corrections for mistyped commands
# Word characters (removed / so path segments are separate words for ^W)
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
# Auto-show timing for commands taking longer than 5 seconds
REPORTTIME=5
# History settings (essentially unlimited)
HISTFILE=~/.zsh_history
HISTSIZE=999999999
SAVEHIST=$HISTSIZE
setopt APPEND_HISTORY # Append to history file
setopt HIST_IGNORE_DUPS # Ignore consecutive duplicates
setopt HIST_IGNORE_SPACE # Ignore commands starting with a space
setopt EXTENDED_HISTORY # Save timestamps and duration
setopt SHARE_HISTORY # Share history across all sessions
setopt HIST_EXPIRE_DUPS_FIRST # Drop older dupes first when trimming history
setopt HIST_VERIFY # Show expanded history line before executing
setopt INC_APPEND_HISTORY # Write history immediately for shared sessions
setopt HIST_IGNORE_ALL_DUPS # Remove any prior duplicate before adding
setopt HIST_FIND_NO_DUPS # ^R and fc skip duplicate matches
setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file
setopt HIST_REDUCE_BLANKS # Trim excess whitespace from commands
# Completion settings (hardcoded brew prefix for faster startup)
if [[ -d /opt/homebrew/share/zsh-completions ]]; then
fpath=("/opt/homebrew/share/zsh-completions" $fpath)
fi
fpath=("$HOME/.zsh/completions" $fpath)
autoload -Uz compinit
# NOTE: If you get insecure directory warnings, run:
# chmod go-w /opt/homebrew/share/zsh-completions
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' menu select
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path "$HOME/.zcompcache"
zstyle ':completion:*' rehash true
compinit -C
# Custom zsh files (with existence checks)
[[ -f $HOME/.zsh/worktree-manager.zsh ]] && source $HOME/.zsh/worktree-manager.zsh
[[ -f $HOME/.zsh/functions.zsh ]] && source $HOME/.zsh/functions.zsh
[[ -f $HOME/.zsh/aliases.zsh ]] && source $HOME/.zsh/aliases.zsh
# Visual tweaks
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# GitHub settings
typeset +gx -A GITHUB
GITHUB[user]=stephanschubert
chpwd() {
emulate -L zsh
ls -F
}
# Emacs keybindings
bindkey -e
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^U' kill-whole-line
bindkey '^W' backward-kill-word
bindkey '\ed' kill-word
bindkey '\ep' up-line-or-history
bindkey '\en' down-line-or-history
bindkey '^_' undo
bindkey '^X^U' undo
bindkey '^I' expand-or-complete
bindkey '\e/' expand-word
bindkey '^X^E' edit-command-line
bindkey '^ ' autosuggest-accept
bindkey '^R' history-incremental-pattern-search-backward
bindkey '^S' history-incremental-pattern-search-forward
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
# Sudo toggle widget (Esc-Esc prepends sudo)
sudo-command-line() {
[[ -z $BUFFER ]] && zle up-history
[[ $BUFFER != sudo\ * ]] && BUFFER="sudo $BUFFER"
zle end-of-line
}
zle -N sudo-command-line
bindkey '\e\e' sudo-command-line
# External tools and completions
setopt PROMPT_SUBST
command -v starship >/dev/null && eval "$(starship init zsh)"
[[ -f /opt/homebrew/etc/profile.d/autojump.sh ]] && . /opt/homebrew/etc/profile.d/autojump.sh
# Set up fzf key bindings and fuzzy completion
export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND
export FZF_ALT_C_COMMAND='fd --type d --hidden --follow --exclude .git'
export FZF_CTRL_T_OPTS="--preview 'bat --color=always --style=numbers --line-range=:500 {} 2>/dev/null || cat {}'"
export FZF_ALT_C_OPTS="--preview 'ls -la {}'"
export FZF_CTRL_R_OPTS="
--preview 'echo {}' --preview-window up:3:hidden:wrap
--bind 'ctrl-/:toggle-preview'
--bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'
--color header:italic
--header 'Press CTRL-Y to copy command into clipboard'"
if [[ -r /opt/homebrew/opt/fzf/shell/completion.zsh ]]; then
source /opt/homebrew/opt/fzf/shell/completion.zsh
fi
if [[ -r /opt/homebrew/opt/fzf/shell/key-bindings.zsh ]]; then
source /opt/homebrew/opt/fzf/shell/key-bindings.zsh
fi
# asdf version manager (must come after PATH modifications to take precedence)
asdf() {
unset -f asdf
. /opt/homebrew/opt/asdf/libexec/asdf.sh
asdf "$@"
}
# Zsh autosuggestions configuration
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
# Zsh enhancements (with existence checks)
[[ -f /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && \
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
[[ -f /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]] && \
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
setopt NO_BEEP
setopt NO_LIST_BEEP
# Node optimization
export NODE_COMPILE_CACHE=~/.cache/nodejs-compile-cache
# Task Master aliases
alias tm='task-master'
alias taskmaster='task-master'
alias reload='source ~/.zshrc'
# Secrets (API keys stored separately)
[[ -f ~/.secrets ]] && source ~/.secrets
# Claude/Kimi function (uses subshell to avoid polluting environment)
kimi() {
(
export ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic
export ANTHROPIC_AUTH_TOKEN=$KIMI_API_KEY
claude "$@"
)
}
# Amazon Q post block (keep at bottom)
# Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh"