Last active
January 28, 2026 03:20
-
-
Save coopermayne/a2c8fb30414a52c098ce7f83e5354e20 to your computer and use it in GitHub Desktop.
portable-zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================= | |
| # PORTABLE ZSHRC - Works on macOS and Linux | |
| # ============================================================================= | |
| # DEPENDENCIES TO INSTALL: | |
| # - fzf : Fuzzy finder [macOS: brew | Linux: apt] | |
| # - lazygit : Git TUI [macOS: brew | Linux: brew or GitHub releases] | |
| # - lazydocker : Docker TUI [macOS: brew | Linux: brew or GitHub releases] | |
| # - btop : System monitor [macOS: brew | Linux: apt] | |
| # - zoxide : Smarter cd [macOS: brew | Linux: apt] | |
| # - glow : Markdown viewer [macOS: brew | Linux: apt or snap] | |
| # - claude : Claude Code CLI [both: npm install -g @anthropic-ai/claude-code] | |
| # | |
| # INSTALL COMMANDS: | |
| # macOS: brew install fzf lazygit lazydocker btop zoxide glow | |
| # Linux: sudo apt install fzf btop zoxide glow | |
| # brew install lazygit lazydocker (or see GitHub releases) | |
| # ============================================================================= | |
| # Detect OS | |
| case "$(uname -s)" in | |
| Darwin) IS_MAC=true ;; | |
| Linux) IS_MAC=false ;; | |
| esac | |
| # PATH | |
| export PATH="$HOME/.local/bin:$HOME/bin:/usr/local/bin:$PATH" | |
| export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH" | |
| # Prompt with git info | |
| autoload -Uz vcs_info | |
| precmd() { vcs_info } | |
| zstyle ':vcs_info:git:*' formats ' %F{yellow}(%b)%f' | |
| zstyle ':vcs_info:git:*' actionformats ' %F{yellow}(%b|%a)%f' | |
| setopt PROMPT_SUBST | |
| PROMPT='%F{cyan}%~%f${vcs_info_msg_0_} %F{magenta}>%f ' | |
| # Better ls (cross-platform colors) | |
| if $IS_MAC; then | |
| alias ls='ls -G' | |
| alias ll='ls -lahG' | |
| alias la='ls -aG' | |
| else | |
| alias ls='ls --color=auto' | |
| alias ll='ls -lah --color=auto' | |
| alias la='ls -a --color=auto' | |
| fi | |
| # Completion (case-insensitive, partial matching) | |
| autoload -Uz compinit && compinit | |
| zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' | |
| # Aliases (only if commands exist) | |
| command -v claude >/dev/null && { | |
| alias c='claude' | |
| alias cc='claude --dangerously-skip-permissions' | |
| alias cr='claude --dangerously-skip-permissions --disallowedTools "Edit,Write,Bash,NotebookEdit"' | |
| } | |
| command -v lazygit >/dev/null && alias lg='lazygit' | |
| command -v lazydocker >/dev/null && alias ld='lazydocker' | |
| command -v btop >/dev/null && alias bt='btop' | |
| # Directory navigation | |
| alias ..='cd ..' | |
| alias ...='cd ../..' | |
| alias ....='cd ../../..' | |
| alias .....='cd ../../../..' | |
| alias ......='cd ../../../../..' | |
| # zoxide - smarter cd (use 'z' to jump to directories) | |
| command -v zoxide >/dev/null && eval "$(zoxide init zsh)" | |
| # fzf - fuzzy history search (Ctrl+R) | |
| if command -v fzf >/dev/null; then | |
| # fzf 0.48+ uses --zsh, older versions use different setup | |
| if fzf --zsh >/dev/null 2>&1; then | |
| eval "$(fzf --zsh)" | |
| elif [ -f ~/.fzf.zsh ]; then | |
| source ~/.fzf.zsh | |
| fi | |
| export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' | |
| fi | |
| # ============================================================================= | |
| # PROJECT-SPECIFIC TOOLS | |
| # ============================================================================= | |
| # pyenv (needed for Python projects) | |
| export PYENV_ROOT="$HOME/.pyenv" | |
| [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" | |
| command -v pyenv >/dev/null && eval "$(pyenv init - zsh)" | |
| # nvm (needed for Node/frontend) | |
| export NVM_DIR="$HOME/.nvm" | |
| [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
| # direnv (auto-load .envrc per project) | |
| command -v direnv >/dev/null && eval "$(direnv hook zsh)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment