-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc-copy
More file actions
121 lines (103 loc) · 5.55 KB
/
zshrc-copy
File metadata and controls
121 lines (103 loc) · 5.55 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
# ===============================
# ~/.zshrc — Z Shell Configuration
# ===============================
# What is zsh?
# zsh (Z Shell) is a powerful alternative to bash, the default Unix shell.
# It offers better autocompletion, smarter history, plugins, and themes.
# macOS now ships with zsh as the default shell.
#
# Why do developers use it?
# - Productivity: advanced tab completion and command history
# - Customization: themes (like Starship) and plugins
# - Portability: works on macOS, Linux, WSL
# - Ecosystem: widely supported by tools like VS Code, Ghostty, tmux
#
# The ~/.zshrc file is where we configure zsh. It runs every time
# a new interactive shell starts (e.g. VS Code terminal, Ghostty).
# This is where we define PATH, aliases, environment variables, and init tools.
# --- Developer data location (keeps $HOME tidy) ---
# We store tool state (cargo, rustup, npm globals, venvs, etc.) in ~/Code/.dev.
# Tools that expect their defaults in $HOME continue to work via symlinks.
export DEV_HOME="$HOME/Code/.dev"
export CARGO_HOME="$DEV_HOME/.cargo"
export RUSTUP_HOME="$DEV_HOME/.cargo/rustup"
export UV_VENV_HOME="$DEV_HOME/.venvs"
# --- Default working directory for local interactive sessions ---
# When launching a shell from the local machine (not SSH), start in ~/Code.
[[ -z "$SSH_TTY" && "$PWD" = "$HOME" ]] && cd "$HOME/Code"
# --- Volta (Node/TS toolchain shims) ---
# Volta must be FIRST in PATH so node/npm/yarn/pnpm resolve to Volta shims.
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
# --- Homebrew in PATH (Apple Silicon) ---
# Homebrew installs packages into /opt/homebrew on Apple Silicon.
# The 'brew shellenv' command sets PATH and other variables so we can use brew-installed tools.
# Keep this AFTER Volta so brew-installed node can't shadow Volta.
if [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# --- User local bin + npm global bin (current prefix) ---
# ~/.local/bin is commonly used by Python tools (uv/pipx/etc.).
# Your current npm global prefix is: ~/Code/.dev/.npm-global
export PATH="$HOME/.local/bin:$PATH"
export PATH="$DEV_HOME/.npm-global/bin:$PATH"
# --- Prompt (Starship): fast & readable ---
# Starship is a universal, themeable prompt. It shows useful info (git branch, language versions, time).
# This keeps the shell informative without being cluttered.
command -v starship >/dev/null 2>&1 && eval "$(starship init zsh)"
# --- Navigation helpers ---
# zoxide: smarter 'cd'. It remembers directories you visit and lets you jump with `z <name>`.
command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init zsh)"
# fzf: fuzzy finder. Adds Ctrl-R search for command history and fuzzy file search.
# The installer created ~/.fzf.zsh which we source here.
[ -f "$HOME/.fzf.zsh" ] && source "$HOME/.fzf.zsh"
# --- Per-project envs (direnv) ---
# direnv loads environment variables automatically when you enter a directory with an .envrc file.
# This keeps secrets and project-specific settings isolated from your global shell.
command -v direnv >/dev/null 2>&1 && eval "$(direnv hook zsh)"
# --- zsh plugins (optional) ---
# If installed via Homebrew: brew install zsh-autosuggestions zsh-syntax-highlighting
# We source them if present. Syntax highlighting must be last.
_ZBREW="$(command -v brew >/dev/null 2>&1 && brew --prefix || echo /opt/homebrew)"
[ -f "$_ZBREW/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && \
source "$_ZBREW/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
[ -f "$_ZBREW/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] && \
source "$_ZBREW/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
# --- Friendly aliases ---
# Aliases are shortcuts that save typing and add features.
alias ls="eza --group-directories-first --icons" # modern replacement for 'ls'
alias ll="eza -l --group-directories-first --icons" # long listing
alias la="eza -la --group-directories-first --icons" # show hidden files
alias gs="git status -sb" # short git status
alias cat="bat --style=plain --paging=never" # syntax-highlighted 'cat'
alias top="btm" # graphical system monitor (brew install bottom)
alias mux="zellij" # terminal multiplexer
# --- Ghostty workload profiles ---
# Open a new Ghostty window tuned for each haunting workload.
# Usage: gt-inference, gt-aws, gt-otel, gt-rocm, gt-ext, gt-forge
_GT="/Applications/Ghostty.app/Contents/MacOS/ghostty"
_GP="$HOME/.config/ghostty/profiles"
alias gt-inference="$_GT --config-file=$_GP/inference.conf"
alias gt-aws="$_GT --config-file=$_GP/aws.conf"
alias gt-otel="$_GT --config-file=$_GP/otel.conf"
alias gt-rocm="$_GT --config-file=$_GP/ssh-rocm.conf"
alias gt-ext="$_GT --config-file=$_GP/chrome-ext.conf"
alias gt-forge="$_GT --config-file=$_GP/mcp-forge.conf"
# SSH into ROCm-AIBOX in a dedicated red-accented window
gt-ssh-rocm() {
"$_GT" --config-file="$_GP/ssh-rocm.conf" --command="ssh haunt-rocm $*"
}
# --- Editor preference ---
# These tell tools (like git) which editor to use when one is needed.
export EDITOR="vim"
export VISUAL="$EDITOR"
# --- Rust toolchain ---
# If the cargo env file is present (it exports PATH and completion), source it.
[ -f "$CARGO_HOME/env" ] && source "$CARGO_HOME/env"
# --- Python (uv and local bins) ---
# ~/.local/bin was added above; uv/venvs live under $UV_VENV_HOME per the setting above.
# --- GPG: ensure pinentry works in terminal ---
export GPG_TTY="$(tty)"
# --- Shell quality-of-life ---
# Allow inline comments in interactive mode, etc.
setopt interactivecomments