Commit f9a1dba194
Verified · cmc
Layout: unified · split
zsh/.zshrc +52 −24
| @@ -1,14 +1,30 @@ | ||
| 1 | 1 | # ============================================================================== |
| 2 | # 1. PRE-INITIALIZATION (Instant Prompt) | |
| 2 | # 1. OS-SPECIFIC CONFIGURATION | |
| 3 | 3 | # ============================================================================== |
| 4 | ||
| 5 | # Use uname to detect the OS and set the correct Homebrew path | |
| 6 | if [[ "$(uname)" == "Darwin" ]]; then | |
| 7 | # macOS (Apple Silicon) | |
| 8 | BREW_PREFIX="/opt/homebrew" | |
| 9 | elif [[ "$(uname)" == "Linux" ]]; then | |
| 10 | # Linux (Linuxbrew) | |
| 11 | BREW_PREFIX="/home/linuxbrew/.linuxbrew" | |
| 12 | fi | |
| 13 | ||
| 14 | # ============================================================================== | |
| 15 | # 2. PRE-INITIALIZATION (Instant Prompt) | |
| 16 | # ============================================================================== | |
| 17 | ||
| 4 | 18 | if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then |
| 5 | 19 | source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" |
| 6 | 20 | fi |
| 7 | 21 | |
| 8 | 22 | # ============================================================================== |
| 9 | # 2. ENVIRONMENT VARIABLES & PATH | |
| 23 | # 3. ENVIRONMENT VARIABLES & PATH | |
| 10 | 24 | # ============================================================================== |
| 11 | export PATH="/Users/cmc/.local/xonsh-env/xbin:$PATH" | |
| 25 | ||
| 26 | export PATH="$HOME/.local/xonsh-env/xbin:$PATH" | |
| 27 | export PATH="$BRE_PREFIX:$PATH" | |
| 12 | 28 | export GPG_TTY=$(tty) |
| 13 | 29 | |
| 14 | 30 | # borgbackup |
| @@ -17,8 +33,15 @@ mkdir -p /tank/borg-cache | ||
| 17 | 33 | |
| 18 | 34 | # NVM Configuration |
| 19 | 35 | export NVM_DIR="$HOME/.nvm" |
| 20 | [ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" | |
| 21 | [ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" | |
| 36 | NVM_SH_PATH="$BREW_PREFIX/opt/nvm/nvm.sh" | |
| 37 | if [[ -s "$NVM_SH_PATH" ]]; then | |
| 38 | source "$NVM_SH_PATH" | |
| 39 | fi | |
| 40 | ||
| 41 | NVM_BASH_COMPLETION_PATH="$BREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" | |
| 42 | if [[ -s "$NVM_BASH_COMPLETION_PATH" ]]; then | |
| 43 | source "$NVM_BASH_COMPLETION_PATH" | |
| 44 | fi | |
| 22 | 45 | |
| 23 | 46 | # History Settings |
| 24 | 47 | HISTFILE=~/.histfile |
| @@ -26,19 +49,24 @@ HISTSIZE=1000 | ||
| 26 | 49 | SAVEHIST=1000 |
| 27 | 50 | |
| 28 | 51 | # ============================================================================== |
| 29 | # 3. COMPLETION & UI SETTINGS | |
| 52 | # 4. COMPLETION & UI SETTINGS | |
| 30 | 53 | # ============================================================================== |
| 54 | ||
| 31 | 55 | bindkey -e |
| 32 | zstyle :compinstall filename '/Users/cmc/.zshrc' | |
| 56 | zstyle :compinstall filename "$HOME/.zshrc" | |
| 33 | 57 | autoload -Uz compinit && compinit |
| 34 | 58 | |
| 35 | # Load Theme | |
| 36 | source /opt/homebrew/share/powerlevel10k/powerlevel10k.zsh-theme | |
| 59 | # p10k | |
| 60 | P10K_THEME_PATH="$BREW_PREFIX/share/powerlevel10k/powerlevel10k.zsh-theme" | |
| 61 | if [[ -f "$P10K_THEME_PATH" ]]; then | |
| 62 | source "$P10K_THEME_PATH" | |
| 63 | fi | |
| 37 | 64 | [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |
| 38 | 65 | |
| 39 | 66 | # ============================================================================== |
| 40 | # 4. ALIASES | |
| 67 | # 5. ALIASES | |
| 41 | 68 | # ============================================================================== |
| 69 | ||
| 42 | 70 | alias l="ls -lha" |
| 43 | 71 | alias emacs="emacs -nw" |
| 44 | 72 | alias xclean="find . -name '.DS_Store' -type f -delete" |
| @@ -57,31 +85,31 @@ alias gcob='git checkout -b' | ||
| 57 | 85 | alias gma='git checkout main' |
| 58 | 86 | |
| 59 | 87 | # ============================================================================== |
| 60 | # 5. PLUGINS (Must be loaded after aliases for best results) | |
| 88 | # 6. PLUGINS (Must be loaded after aliases for best results) | |
| 61 | 89 | # ============================================================================== |
| 62 | source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh | |
| 63 | 90 | |
| 64 | # Syntax Highlighting MUST be the last thing sourced | |
| 65 | source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
| 91 | # Zsh Autosuggestions | |
| 92 | ZSH_AUTOSUGGESTIONS_PATH="$BREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh" | |
| 93 | if [[ -f "$ZSH_AUTOSUGGESTIONS_PATH" ]]; then | |
| 94 | source "$ZSH_AUTOSUGGESTIONS_PATH" | |
| 95 | fi | |
| 96 | ||
| 97 | # Syntax Highlighting | |
| 98 | ZSH_SYNTAX_HIGHLIGHTING_PATH="$BREW_PREFIX/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" | |
| 99 | if [[ -f "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ]]; then | |
| 100 | source "$ZSH_SYNTAX_HIGHLIGHTING_PATH" | |
| 101 | fi | |
| 66 | 102 | |
| 67 | 103 | # ============================================================================== |
| 68 | # 6. SYNTAX HIGHLIGHTING CUSTOMIZATION | |
| 104 | # 7. SYNTAX HIGHLIGHTING CUSTOMIZATION | |
| 69 | 105 | # ============================================================================== |
| 106 | ||
| 70 | 107 | # Must be defined AFTER the plugin is sourced |
| 71 | 108 | # Colors available: black, red, green, yellow, blue, magenta, cyan, white |
| 72 | 109 | # Styles: bold, underline |
| 73 | 110 | |
| 74 | # Highlight aliases in Cyan | |
| 75 | 111 | ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan,bold' |
| 76 | ||
| 77 | # Highlight standard commands in Green | |
| 78 | 112 | ZSH_HIGHLIGHT_STYLES[command]='fg=green' |
| 79 | ||
| 80 | # Highlight built-ins (like cd, echo) in Magenta | |
| 81 | 113 | ZSH_HIGHLIGHT_STYLES[builtin]='fg=magenta' |
| 82 | ||
| 83 | # Highlight valid paths in White with an underline | |
| 84 | 114 | ZSH_HIGHLIGHT_STYLES[path]='fg=white,underline' |
| 85 | ||
| 86 | # Highlight errors (typos) in Red | |
| 87 | 115 | ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold' |