-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
217 lines (183 loc) · 6.67 KB
/
Copy pathzshrc
File metadata and controls
217 lines (183 loc) · 6.67 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
216
217
###############################################################################
# MINIMAL .zshrc - No plugin manager, maximum speed
# Startup time target: <300ms
###############################################################################
# Hack to skip installing on Spinstances
if [ -z ${SPIN+x} ]; then
export GIT_EDITOR="vi"
fi
export PATH="/usr/local/sbin:$PATH"
export PATH="/Users/mitch.lillie/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
###############################################################################
# ZSH Configuration (no Oh-My-Zsh needed!)
###############################################################################
# Enable colors
autoload -U colors && colors
# Basic completion
autoload -Uz compinit
# Only regenerate compdump once a day for speed
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
compinit
else
compinit -C
fi
# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_FIND_NO_DUPS
setopt HIST_REDUCE_BLANKS
# Directory navigation
setopt AUTO_CD
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
###############################################################################
# Prompt - Simple and fast (replace Oh-My-Zsh theme)
###############################################################################
# Git status function
git_prompt_info() {
local ref
ref=$(git symbolic-ref HEAD 2> /dev/null) || return 0
echo " (${ref#refs/heads/})"
}
# Simple two-line prompt similar to your Oh-My-Zsh theme
setopt PROMPT_SUBST
PROMPT='%{$fg[cyan]%}%n@%m%{$reset_color%}%{$fg[yellow]%}$(git_prompt_info)%{$reset_color%}
%{$fg[green]%}→%{$reset_color%} '
###############################################################################
# Plugin Replacements (manual, fast)
###############################################################################
# Colored man pages (replaces colored-man-pages plugin)
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
# Z / autojump replacement - use built-in zsh feature
# This is faster than the z plugin
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
setopt PUSHDMINUS
alias d='dirs -v'
for index ({1..9}) alias "$index"="cd +${index}"; unset index
###############################################################################
# FZF
###############################################################################
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
###############################################################################
# Brew (cached)
###############################################################################
if [[ -x /opt/homebrew/bin/brew ]]; then
if [[ ! -f ~/.brew-shellenv-cache ]] || [[ /opt/homebrew/bin/brew -nt ~/.brew-shellenv-cache ]]; then
/opt/homebrew/bin/brew shellenv > ~/.brew-shellenv-cache
fi
source ~/.brew-shellenv-cache
fi
###############################################################################
# NVM
###############################################################################
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
###############################################################################
# Shopify Dev
###############################################################################
[ -f /opt/dev/dev.sh ] && source /opt/dev/dev.sh
# Lazy-load chruby
[[ -f /opt/dev/sh/chruby/chruby.sh ]] && { type chruby >/dev/null 2>&1 || chruby () { source /opt/dev/sh/chruby/chruby.sh; chruby "$@"; } }
###############################################################################
# Android
###############################################################################
export PATH=~/Library/Android/sdk/tools:$PATH
export PATH=~/Library/Android/sdk/platform-tools:$PATH
###############################################################################
# pnpm
###############################################################################
export PNPM_HOME="/Users/mitch/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
###############################################################################
# TEC (cached)
###############################################################################
if [[ -x /Users/mitch/.local/state/tec/profiles/base/current/global/init ]]; then
if [[ ! -f ~/.tec-init-cache ]] || [[ /Users/mitch/.local/state/tec/profiles/base/current/global/init -nt ~/.tec-init-cache ]]; then
/Users/mitch/.local/state/tec/profiles/base/current/global/init zsh > ~/.tec-init-cache
fi
source ~/.tec-init-cache
fi
###############################################################################
# Custom Functions
###############################################################################
# Worktree function
wt() {
local worktree_path
worktree_path=$(git -C ~/world/git worktree list --porcelain | \
awk '/^worktree/ {path=$2} /^branch/ {sub(/.*\//, "", $2); print $2 "\t" path}' | \
grep -v '(bare)' | \
fzf --height=40% --reverse --delimiter='\t' --with-nth=1 | \
cut -f2)
if [[ -n "$worktree_path" ]]; then
cd "$worktree_path/areas/clients/admin-web" || return 1
fi
}
###############################################################################
# Git Aliases
###############################################################################
alias g='git'
alias gs='git status'
alias ga='git add -p' # Interactive add
alias gaa='git add --all' # Add all
alias gc='git commit'
alias gcmsg='git commit -m'
alias gd='git diff'
alias gds='git diff --staged'
alias gco='git checkout'
alias gcm='git checkout main'
alias gb='git branch'
alias gp='git push'
alias gpf='git push -f'
alias gl='git pull'
alias glg='git log --stat'
alias glog='git log --oneline --decorate --graph'
# Graphite
alias gts='gt submit'
alias gtm='gt modify'
alias gtsync='gt sync'
# Dev workflow
alias dup='dev up'
alias dpv='dev prod vite'
alias devprod='dev up && dev prod vite'
# Shopify
alias sdev='shopify app dev'
alias sgen='shopify app generate extension'
alias sdep='shopify app deploy'
# Typo protection
alias staus='git status'
alias pusf='git push -f'
# E2E testing
e2e-repeat() {
dev e2e "$1" --repeat-each="${2:-10}"
}
e2e-debug() {
PWDEBUG=console dev e2e "$1" --ui
}
e2e-grep() {
dev e2e "$1" --grep "$2" "${@:3}"
}
# Git workflow helpers
gnb() {
git checkout main && git pull && git checkout -b "$1"
}
gtflow() {
git add -p && gt modify && gt submit
}
devext() {
dev cd extensibility && dev up
}