From 590cb005999e9e9d497bf67aa40d6a7a78cc0f1f Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 15 Feb 2026 18:09:57 -0600 Subject: split files into common, linux, and macos directories --- common/zsh/.zprofile | 16 +++++++ common/zsh/.zshrc | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 common/zsh/.zprofile create mode 100644 common/zsh/.zshrc (limited to 'common/zsh') diff --git a/common/zsh/.zprofile b/common/zsh/.zprofile new file mode 100644 index 0000000..67eda70 --- /dev/null +++ b/common/zsh/.zprofile @@ -0,0 +1,16 @@ +# ============================================================================== +# HOMEBREW INITIALIZATION (macOS & Linux) +# ============================================================================== + +if [[ "$(uname)" == "Darwin" ]]; then + # macOS (Apple Silicon) + BREW_PATH="/opt/homebrew/bin/brew" +elif [[ "$(uname)" == "Linux" ]]; then + # Linux (Linuxbrew) + BREW_PATH="/home/linuxbrew/.linuxbrew/bin/brew" +fi + +# Only run shellenv if the brew binary actually exists at that path +if [[ -f "$BREW_PATH" ]]; then + eval "$($BREW_PATH shellenv)" +fi diff --git a/common/zsh/.zshrc b/common/zsh/.zshrc new file mode 100644 index 0000000..aab6477 --- /dev/null +++ b/common/zsh/.zshrc @@ -0,0 +1,120 @@ +# ============================================================================== +# 1. OS-SPECIFIC CONFIGURATION +# ============================================================================== + +# Use uname to detect the OS and set the correct Homebrew path +if [[ "$(uname)" == "Darwin" ]]; then + # macOS (Apple Silicon) + BREW_PREFIX="/opt/homebrew" +elif [[ "$(uname)" == "Linux" ]]; then + # Linux (Linuxbrew) + BREW_PREFIX="/home/linuxbrew/.linuxbrew" +fi + +# ============================================================================== +# 2. PRE-INITIALIZATION (Instant Prompt) +# ============================================================================== + +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# ============================================================================== +# 3. ENVIRONMENT VARIABLES & PATH +# ============================================================================== + +export PATH="$HOME/.local/xonsh-env/xbin:$PATH" +export PATH="$BREW_PREFIX/bin:$PATH" +export GPG_TTY=$(tty) + +# borgbackup +if [[ "$(uname)" == "Linux" ]]; then + export BORG_CACHE_DIR="/tank/borg-cache" + mkdir -p /tank/borg-cache +fi + +# NVM Configuration +export NVM_DIR="$HOME/.nvm" +NVM_SH_PATH="$BREW_PREFIX/opt/nvm/nvm.sh" +if [[ -s "$NVM_SH_PATH" ]]; then + source "$NVM_SH_PATH" +fi + +NVM_BASH_COMPLETION_PATH="$BREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" +if [[ -s "$NVM_BASH_COMPLETION_PATH" ]]; then + source "$NVM_BASH_COMPLETION_PATH" +fi + +# History Settings +HISTFILE=~/.histfile +HISTSIZE=30000 +SAVEHIST=30000 +setopt SHARE_HISTORY +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_REDUCE_BLANKS + +# ============================================================================== +# 4. COMPLETION & UI SETTINGS +# ============================================================================== + +bindkey -e +zstyle :compinstall filename "$HOME/.zshrc" +autoload -Uz compinit && compinit + +# p10k +P10K_THEME_PATH="$BREW_PREFIX/share/powerlevel10k/powerlevel10k.zsh-theme" +if [[ -f "$P10K_THEME_PATH" ]]; then + source "$P10K_THEME_PATH" +fi +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh + +# ============================================================================== +# 5. ALIASES +# ============================================================================== + +alias l="ls -lha" +alias emacs="emacs -nw" +alias xclean="find . -name '.DS_Store' -type f -delete" + +# Git +alias g='git' +alias gs='git status' +alias ga='git add' +alias gaa='git add --all' +alias gc='git commit -v' +alias gcm='git commit -m' +alias gca='git commit --amend --no-edit' +alias gb='git branch' +alias gco='git checkout' +alias gcob='git checkout -b' +alias gma='git checkout main' + +# ============================================================================== +# 6. PLUGINS (Must be loaded after aliases for best results) +# ============================================================================== + +# Zsh Autosuggestions +ZSH_AUTOSUGGESTIONS_PATH="$BREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh" +if [[ -f "$ZSH_AUTOSUGGESTIONS_PATH" ]]; then + source "$ZSH_AUTOSUGGESTIONS_PATH" +fi + +# Syntax Highlighting +ZSH_SYNTAX_HIGHLIGHTING_PATH="$BREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" +if [[ -f "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ]]; then + source "$ZSH_SYNTAX_HIGHLIGHTING_PATH" +fi + +# ============================================================================== +# 7. SYNTAX HIGHLIGHTING CUSTOMIZATION +# ============================================================================== + +# Must be defined AFTER the plugin is sourced +# Colors available: black, red, green, yellow, blue, magenta, cyan, white +# Styles: bold, underline + +ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan,bold' +ZSH_HIGHLIGHT_STYLES[command]='fg=green' +ZSH_HIGHLIGHT_STYLES[builtin]='fg=magenta' +ZSH_HIGHLIGHT_STYLES[path]='fg=white,underline' +ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold' -- cgit v1.2.3