diff --git a/zsh/.mac_config.zsh_mac.example b/zsh/.mac_config.zsh_mac.example index 7341fd2..82a0a8b 100644 --- a/zsh/.mac_config.zsh_mac.example +++ b/zsh/.mac_config.zsh_mac.example @@ -8,11 +8,11 @@ defaults write .GlobalPreferences AppleLocale en_DE ARCH=`uname -m` if [[ $ARCH == "arm64" ]]; then - HOMEBREWPREFIX="/opt/homebrew" + export HOMEBREW_PREFIX="/opt/homebrew" else - HOMEBREWPREFIX="/usr/local" + export HOMEBREW_PREFIX="/usr/local" fi -export PATH="$HOMEBREWPREFIX/opt/coreutils/libexec/gnubin:$HOME/.local/bin:$HOMEBREWPREFIX/bin:$PATH:$HOMEBREWPREFIX/sbin" +export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOME/.local/bin:$HOMEBREW_PREFIX/bin:$PATH:$HOMEBREW_PREFIX/sbin" # test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh" @@ -27,9 +27,9 @@ if [ -f "$HOMEBREW_COMMAND_NOT_FOUND_HANDLER" ]; then source "$HOMEBREW_COMMAND_NOT_FOUND_HANDLER"; fi -export DYLD_FALLBACK_LIBRARY_PATH="$HOMEBREW_PREFIX/lib:${DYLD_FALLBACK_LIBRARY_PATH}" -export GI_TYPELIB_PATH="$HOMEBREW_PREFIX/lib/girepository-1.0:${GI_TYPELIB_PATH}" -export PKG_CONFIG_PATH="$HOMEBREW_PREFIX/lib/pkgconfig:$HOMEBREW_PREFIX/share/pkgconfig:${PKG_CONFIG_PATH}" +export DYLD_FALLBACK_LIBRARY_PATH="$HOMEBREW_PREFIX/lib${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}" +export GI_TYPELIB_PATH="$HOMEBREW_PREFIX/lib/girepository-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}" +export PKG_CONFIG_PATH="$HOMEBREW_PREFIX/lib/pkgconfig:$HOMEBREW_PREFIX/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" alias claude="workon claude; claude; deactivate" alias python="python3" diff --git a/zsh/.zshrc b/zsh/.zshrc index 41dcff3..39f706d 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -146,9 +146,9 @@ delzip() { export MITMPROXY_SSLKEYLOGFILE="~/.mitmproxy/sslkeylogfile.txt" [[ -f ~/.zsh/.mac_config.zsh ]] && source ~/.zsh/.mac_config.zsh -if `which go &>/dev/null`; then - export PATH="$PATH:$(go env GOPATH)/bin" - export GOPATH=$(go env GOPATH) +if (( $+commands[go] )); then + export GOPATH="$(go env GOPATH 2>/dev/null)" + [[ -n "$GOPATH" ]] && path+=("$GOPATH/bin") fi # Use safecp/safemv from the tools-repo when available (after ~/.local/bin is on PATH) @@ -205,8 +205,9 @@ zstyle :bracketed-paste-magic paste-finish pastefinish # https://github.com/zsh-users/zsh-autosuggestions/issues/351 ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(bracketed-paste) -export PATH=$PATH:/Users/ising/.runai/bin -runai_bin=/Users/ising/.runai/bin/runai +[[ -d "$HOME/.lmstudio/bin" ]] && path+=("$HOME/.lmstudio/bin") +[[ -d "$HOME/.runai/bin" ]] && path+=("$HOME/.runai/bin") +runai_bin="$HOME/.runai/bin/runai" runai_completion=${ZDOTDIR:-$HOME}/.cache/zsh/runai-completion.zsh if [[ -x "$runai_bin" ]]; then if [[ ! -s "$runai_completion" || "$runai_bin" -nt "$runai_completion" ]]; then @@ -226,7 +227,7 @@ fi # in via `-e VIRTUAL_ENV=...`, see .tmux.conf) we source the venv's activate # script here rather than in .virtual_env_config.zsh. activate snapshots the # current PATH into _OLD_VIRTUAL_PATH and restores it on `deactivate`; if we -# activated earlier (before .mac_config.zsh, go, runai below all prepend to +# activated earlier (before .mac_config.zsh, Go, Run:AI, and LM Studio mutate # PATH) that snapshot would be incomplete and `deactivate` would strip # ~/.local/bin & friends — dropping claude and co. off PATH. Keeping this last # guarantees the snapshot is the fully-built PATH. @@ -235,6 +236,7 @@ fi # # A new tmux window clears the var to empty (`bind c ... -e VIRTUAL_ENV=`) to # force the base environment; drop that empty value so nothing sees a bogus venv. +typeset -U path PATH [ -z "${VIRTUAL_ENV:-}" ] && unset VIRTUAL_ENV if [ -n "$VIRTUAL_ENV" ] && [ -f "$VIRTUAL_ENV/bin/activate" ]; then # Guard against double-activation on a manual `source ~/.zshrc`.