clone of my dotfiles.ssp.sh
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add ohmyzsh

sspaeti bbba06f0 e54dc456

+235 -1
+1 -1
Makefile
··· 3 3 .DEFAULT_GOAL := arch 4 4 5 5 # Shared packages (work on both platforms) 6 - SHARED = nvim git zsh tmux kitty ghostty lazygit k9s btop fzf helix presenterm ruff sesh mutt msmtp lazydocker yazi 6 + SHARED = nvim git zsh tmux kitty ghostty lazygit k9s btop fzf helix presenterm ruff sesh mutt msmtp lazydocker yazi oh-my-zsh 7 7 8 8 # Platform-specific packages 9 9 MACOS = karabiner yabai skhd alfred
+234
oh-my-zsh/.oh-my-zsh/oh-my-zsh.sh
··· 1 + # ANSI formatting function (\033[<code>m) 2 + # 0: reset, 1: bold, 4: underline, 22: no bold, 24: no underline, 31: red, 33: yellow 3 + omz_f() { 4 + [ $# -gt 0 ] || return 5 + IFS=";" printf "\033[%sm" $* 6 + } 7 + # If stdout is not a terminal ignore all formatting 8 + [ -t 1 ] || omz_f() { :; } 9 + 10 + # Protect against non-zsh execution of Oh My Zsh (use POSIX syntax here) 11 + [ -n "$ZSH_VERSION" ] || { 12 + omz_ptree() { 13 + # Get process tree of the current process 14 + pid=$$; pids="$pid" 15 + while [ ${pid-0} -ne 1 ] && ppid=$(ps -e -o pid,ppid | awk "\$1 == $pid { print \$2 }"); do 16 + pids="$pids $pid"; pid=$ppid 17 + done 18 + 19 + # Show process tree 20 + case "$(uname)" in 21 + Linux) ps -o ppid,pid,command -f -p $pids 2>/dev/null ;; 22 + Darwin|*) ps -o ppid,pid,command -p $pids 2>/dev/null ;; 23 + esac 24 + 25 + # If ps command failed, try Busybox ps 26 + [ $? -eq 0 ] || ps -o ppid,pid,comm | awk "NR == 1 || index(\"$pids\", \$2) != 0" 27 + } 28 + 29 + { 30 + shell=$(ps -o pid,comm | awk "\$1 == $$ { print \$2 }") 31 + printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded from: $(omz_f 1)${shell}$(omz_f 22). " 32 + printf "You need to run $(omz_f 1)zsh$(omz_f 22) instead.$(omz_f 0)\n" 33 + printf "$(omz_f 33)Here's the process tree:$(omz_f 22)\n\n" 34 + omz_ptree 35 + printf "$(omz_f 0)\n" 36 + } >&2 37 + 38 + return 1 39 + } 40 + 41 + # Check if in emulation mode, if so early return 42 + # https://github.com/ohmyzsh/ohmyzsh/issues/11686 43 + [[ "$(emulate)" = zsh ]] || { 44 + printf "$(omz_f 1 31)Error:$(omz_f 22) Oh My Zsh can't be loaded in \`$(emulate)\` emulation mode.$(omz_f 0)\n" >&2 45 + return 1 46 + } 47 + 48 + unset -f omz_f 49 + 50 + # If ZSH is not defined, use the current script's directory. 51 + [[ -n "$ZSH" ]] || export ZSH="${${(%):-%x}:a:h}" 52 + 53 + # Set ZSH_CUSTOM to the path where your custom config files 54 + # and plugins exists, or else we will use the default custom/ 55 + [[ -n "$ZSH_CUSTOM" ]] || ZSH_CUSTOM="$ZSH/custom" 56 + 57 + # Set ZSH_CACHE_DIR to the path where cache files should be created 58 + # or else we will use the default cache/ 59 + [[ -n "$ZSH_CACHE_DIR" ]] || ZSH_CACHE_DIR="$ZSH/cache" 60 + 61 + # Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME 62 + if [[ ! -w "$ZSH_CACHE_DIR" ]]; then 63 + ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh" 64 + fi 65 + 66 + # Create cache and completions dir and add to $fpath 67 + mkdir -p "$ZSH_CACHE_DIR/completions" 68 + (( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath) 69 + 70 + # Check for updates on initial load... 71 + source "$ZSH/tools/check_for_upgrade.sh" 72 + 73 + # Initializes Oh My Zsh 74 + 75 + # add a function path 76 + fpath=($ZSH/{functions,completions} $ZSH_CUSTOM/{functions,completions} $fpath) 77 + 78 + # Load all stock functions (from $fpath files) called below. 79 + autoload -U compaudit compinit zrecompile 80 + 81 + is_plugin() { 82 + local base_dir=$1 83 + local name=$2 84 + builtin test -f $base_dir/plugins/$name/$name.plugin.zsh \ 85 + || builtin test -f $base_dir/plugins/$name/_$name 86 + } 87 + 88 + # Add all defined plugins to fpath. This must be done 89 + # before running compinit. 90 + for plugin ($plugins); do 91 + if is_plugin "$ZSH_CUSTOM" "$plugin"; then 92 + fpath=("$ZSH_CUSTOM/plugins/$plugin" $fpath) 93 + elif is_plugin "$ZSH" "$plugin"; then 94 + fpath=("$ZSH/plugins/$plugin" $fpath) 95 + else 96 + echo "[oh-my-zsh] plugin '$plugin' not found" 97 + fi 98 + done 99 + 100 + # Figure out the SHORT hostname 101 + if [[ "$OSTYPE" = darwin* ]]; then 102 + # macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible. 103 + SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) || SHORT_HOST="${HOST/.*/}" 104 + else 105 + SHORT_HOST="${HOST/.*/}" 106 + fi 107 + 108 + # Save the location of the current completion dump file. 109 + if [[ -z "$ZSH_COMPDUMP" ]]; then 110 + ZSH_COMPDUMP="${ZDOTDIR:-$HOME}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}" 111 + fi 112 + 113 + # Construct zcompdump OMZ metadata 114 + zcompdump_revision="#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)" 115 + zcompdump_fpath="#omz fpath: $fpath" 116 + 117 + # Delete the zcompdump file if OMZ zcompdump metadata changed 118 + if ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null \ 119 + || ! command grep -q -Fx "$zcompdump_fpath" "$ZSH_COMPDUMP" 2>/dev/null; then 120 + command rm -f "$ZSH_COMPDUMP" 121 + zcompdump_refresh=1 122 + fi 123 + 124 + if [[ "$ZSH_DISABLE_COMPFIX" != true ]]; then 125 + source "$ZSH/lib/compfix.zsh" 126 + # Load only from secure directories 127 + compinit -i -d "$ZSH_COMPDUMP" 128 + # If completion insecurities exist, warn the user 129 + handle_completion_insecurities &| 130 + else 131 + # If the user wants it, load from all found directories 132 + compinit -u -d "$ZSH_COMPDUMP" 133 + fi 134 + 135 + # Append zcompdump metadata if missing 136 + if (( $zcompdump_refresh )) \ 137 + || ! command grep -q -Fx "$zcompdump_revision" "$ZSH_COMPDUMP" 2>/dev/null; then 138 + # Use `tee` in case the $ZSH_COMPDUMP filename is invalid, to silence the error 139 + # See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a7269#commitcomment-39003489 140 + tee -a "$ZSH_COMPDUMP" &>/dev/null <<EOF 141 + 142 + $zcompdump_revision 143 + $zcompdump_fpath 144 + EOF 145 + fi 146 + unset zcompdump_revision zcompdump_fpath zcompdump_refresh 147 + 148 + # zcompile the completion dump file if the .zwc is older or missing. 149 + if command mkdir "${ZSH_COMPDUMP}.lock" 2>/dev/null; then 150 + zrecompile -q -p "$ZSH_COMPDUMP" 151 + command rm -rf "$ZSH_COMPDUMP.zwc.old" "${ZSH_COMPDUMP}.lock" 152 + fi 153 + 154 + _omz_source() { 155 + local context filepath="$1" 156 + 157 + # Construct zstyle context based on path 158 + case "$filepath" in 159 + lib/*) context="lib:${filepath:t:r}" ;; # :t = lib_name.zsh, :r = lib_name 160 + plugins/*) context="plugins:${filepath:h:t}" ;; # :h = plugins/plugin_name, :t = plugin_name 161 + esac 162 + 163 + local disable_aliases=0 164 + zstyle -T ":omz:${context}" aliases || disable_aliases=1 165 + 166 + # Back up alias names prior to sourcing 167 + local -A aliases_pre galiases_pre 168 + if (( disable_aliases )); then 169 + aliases_pre=("${(@kv)aliases}") 170 + galiases_pre=("${(@kv)galiases}") 171 + fi 172 + 173 + # Source file from $ZSH_CUSTOM if it exists, otherwise from $ZSH 174 + if [[ -f "$ZSH_CUSTOM/$filepath" ]]; then 175 + source "$ZSH_CUSTOM/$filepath" 176 + elif [[ -f "$ZSH/$filepath" ]]; then 177 + source "$ZSH/$filepath" 178 + fi 179 + 180 + # Unset all aliases that don't appear in the backed up list of aliases 181 + if (( disable_aliases )); then 182 + if (( #aliases_pre )); then 183 + aliases=("${(@kv)aliases_pre}") 184 + else 185 + (( #aliases )) && unalias "${(@k)aliases}" 186 + fi 187 + if (( #galiases_pre )); then 188 + galiases=("${(@kv)galiases_pre}") 189 + else 190 + (( #galiases )) && unalias "${(@k)galiases}" 191 + fi 192 + fi 193 + } 194 + 195 + # Load all of the lib files in ~/.oh-my-zsh/lib that end in .zsh 196 + # TIP: Add files you don't want in git to .gitignore 197 + for lib_file ("$ZSH"/lib/*.zsh); do 198 + _omz_source "lib/${lib_file:t}" 199 + done 200 + unset lib_file 201 + 202 + # Load all of the plugins that were defined in ~/.zshrc 203 + for plugin ($plugins); do 204 + _omz_source "plugins/$plugin/$plugin.plugin.zsh" 205 + done 206 + unset plugin 207 + 208 + # Load all of your custom configurations from custom/ 209 + for config_file ("$ZSH_CUSTOM"/*.zsh(N)); do 210 + source "$config_file" 211 + done 212 + unset config_file 213 + 214 + # Load the theme 215 + is_theme() { 216 + local base_dir=$1 217 + local name=$2 218 + builtin test -f $base_dir/$name.zsh-theme 219 + } 220 + 221 + if [[ -n "$ZSH_THEME" ]]; then 222 + if is_theme "$ZSH_CUSTOM" "$ZSH_THEME"; then 223 + source "$ZSH_CUSTOM/$ZSH_THEME.zsh-theme" 224 + elif is_theme "$ZSH_CUSTOM/themes" "$ZSH_THEME"; then 225 + source "$ZSH_CUSTOM/themes/$ZSH_THEME.zsh-theme" 226 + elif is_theme "$ZSH/themes" "$ZSH_THEME"; then 227 + source "$ZSH/themes/$ZSH_THEME.zsh-theme" 228 + else 229 + echo "[oh-my-zsh] theme '$ZSH_THEME' not found" 230 + fi 231 + fi 232 + 233 + # set completion colors to be the same as `ls`, after theme has been loaded 234 + [[ -z "$LS_COLORS" ]] || zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"