-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathzshrc
More file actions
123 lines (104 loc) · 4.73 KB
/
Copy pathzshrc
File metadata and controls
123 lines (104 loc) · 4.73 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
###########################
# zsh configuration
###########################
# Symlinked to ~/.zshrc (see README). Ported from the fish setup.
# --- environment ---
export LANG=en_US.UTF-8
export EDITOR=nvim
# PATH: homebrew, brew git, ~/.local/bin, repo scripts
export PATH="/usr/local/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/opt/git/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.config/bin:$PATH"
# libpq (needed to build the pg gem)
export LDFLAGS="-L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libpq/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libpq/lib/pkgconfig"
# gpg, for signing commits
export GPG_TTY=$(tty)
# aws-vault
export AWS_VAULT_KEYCHAIN_NAME=login
# --- asdf (before oh-my-zsh so compinit picks up completions) ---
export PATH="$HOME/.asdf/shims:$HOME/.asdf/bin:$PATH"
fpath=(${ASDF_DIR:-$HOME/.asdf}/completions $fpath)
# --- oh-my-zsh ---
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="jbergantine"
plugins=(git)
source $ZSH/oh-my-zsh.sh
# --- functions & aliases ---
# Note: the gp/gP abbreviations use oh-my-zsh's git_current_branch helper.
# ls -la (override oh-my-zsh's `l` alias)
alias l='ls -la'
# Alt+h/j/k/l: move focus between cmux panes from the shell
# (inside nvim the same keys navigate splits first -- see nvim/init.vim)
if [[ -n $CMUX_WORKSPACE_ID ]]; then
_cmux_nav() { cmux-navigate "${WIDGET##*-}" }
for _dir in h j k l; do
zle -N cmux-nav-$_dir _cmux_nav
bindkey "^[$_dir" cmux-nav-$_dir
done
unset _dir
fi
# interactively kill processes with fzf (port of the fish kp)
kp() {
local pid
pid=$(ps -ef | sed 1d | fzf -m --header='[kill:process]' | awk '{print $2}')
if [[ -n $pid ]]; then
echo $pid | xargs kill -${1:-9}
kp
fi
}
# --- fzf key bindings (Ctrl-R history, Ctrl-T files, Alt-C cd) ---
if [[ -f ~/.fzf.zsh ]]; then
source ~/.fzf.zsh
else
source /opt/homebrew/opt/fzf/shell/key-bindings.zsh 2>/dev/null
source /opt/homebrew/opt/fzf/shell/completion.zsh 2>/dev/null
fi
# --- cmux workspace launcher: `start <project>` ---
# Each `cmux workspace create` is one project context; --command auto-starts
# its dev server. Adjust the per-project commands below as your setup changes.
start() {
case "$1" in
smile) _start_smile ;;
""|-h|--help) print -- "usage: start <project> (projects: smile)" ;;
*) print -u2 -- "start: unknown project '$1' (try: smile)"; return 1 ;;
esac
}
_start_smile() {
local root="$HOME/Projects/smile"
# Frontends + services auto-start; core/web open as plain shells.
cmux workspace create --name dev-env --cwd "$root/dev-env-services" --command "smile-cli dc up -d --wait" --focus false
cmux workspace create --name internal --cwd "$root/smile-internal" --command "smile-cli run pnpm start" --focus false
cmux workspace create --name admin --cwd "$root/smile-admin" --command "smile-cli run pnpm start" --focus false
cmux workspace create --name smile-ui --cwd "$root/smile-ui" --command "smile-cli run pnpm start" --focus false
cmux workspace create --name extensions --cwd "$root/smile-shopify-app-extensions" --focus false
cmux workspace create --name endpoints --cwd "$root/smile-data-ingestion-endpoints" --command "smile-cli run bin/dev" --focus false
cmux workspace create --name core --cwd "$root/smile-core" --focus false
cmux workspace create --name web --cwd "$root/smile-core" --focus true
# Close the terminal that ran `start smile` (focus already moved to core above).
# If it's the last surface in its workspace, close the whole workspace instead.
if [[ -n "${CMUX_SURFACE_ID:-}" ]]; then
cmux close-surface --surface "$CMUX_SURFACE_ID" 2>/dev/null \
|| cmux close-workspace --workspace "$CMUX_WORKSPACE_ID"
fi
}
# --- zsh-abbr: fish-style abbreviations (reads ~/.config/zsh-abbr/user-abbreviations) ---
# Source from whichever path exists: Homebrew (personal machine) or oh-my-zsh custom (work machine).
for _abbr in \
/opt/homebrew/share/zsh-abbr/zsh-abbr.zsh \
"${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-abbr/zsh-abbr.zsh"; do
[[ -r "$_abbr" ]] && { source "$_abbr"; break; }
done
unset _abbr
# --- autosuggestions: gray history hints, right-arrow to accept ---
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# --- secrets (never committed -- see ~/.secret.zsh) ---
[[ -f ~/.secret.zsh ]] && source ~/.secret.zsh
# --- cursor: ZLE resets cursor on init; reassert blinking block (\e[1 q) ---
zle-line-init() { echo -ne '\e[1 q' }
zle -N zle-line-init
# --- syntax highlighting MUST be sourced last ---
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh