|
|
@@ -1,40 +1,64 @@
|
|
|
+################################################################################
|
|
|
+# ZSH Configuration
|
|
|
+#
|
|
|
+# Note: in order for files in `~/.config` to be picked up, be sure to set the
|
|
|
+# global `XDG_*` and `ZDOTDIR` paths. On macOS, these are set at `/etc/zshenv`
|
|
|
+# or `~/.zshenv`), and look something like the following block:
|
|
|
+#
|
|
|
+# ```zsh
|
|
|
+# export XDG_CONFIG_HOME=$HOME/.config
|
|
|
+# export XDG_CACHE_HOME=$HOME/.cache
|
|
|
+# export XDG_DATA_HOME=$HOME/.local/share
|
|
|
+# export XDG_STATE_HOME=$HOME/.local/state
|
|
|
+# export XDG_RUNTIME_DIR=$HOME/.run
|
|
|
+# export XDG_DATA_DIRS=/usr/local/share:/usr/share
|
|
|
+# export XDG_CONFIG_DIRS=/etc/xdg
|
|
|
+# export ZDOTDIR=$XDG_CONFIG_HOME/zsh
|
|
|
+# if [ -f $ZDOTDIR/.zshenv ]; then source $ZDOTDIR/.zshenv; fi
|
|
|
+# ```
|
|
|
+#
|
|
|
+################################################################################
|
|
|
+
|
|
|
+################################################################################
|
|
|
+# Disable /etc/zprofile, /etc/zshrc, /etc/zlogin and /etc/zlogout
|
|
|
+################################################################################
|
|
|
+unsetopt GLOBAL_RCS
|
|
|
+
|
|
|
################################################################################
|
|
|
# $PATH and similar
|
|
|
################################################################################
|
|
|
-export GOPATH="$HOME/.go"
|
|
|
-# Add to path without duplicates
|
|
|
-function add_to_path {
|
|
|
- if [[ ! ":$PATH:" == *":$1:"* ]]; then
|
|
|
- if [ "$2" = true ] ; then
|
|
|
- PATH=":$1:$PATH:"
|
|
|
- else
|
|
|
- PATH="$PATH:$1:"
|
|
|
- fi
|
|
|
- PATH=${PATH/::/:/.}
|
|
|
- if [[ "$PATH" == ":"* ]]; then
|
|
|
- PATH="${PATH:1}"
|
|
|
- fi
|
|
|
- if [[ "$PATH" == *":" ]]; then
|
|
|
- PATH="${PATH::-1}"
|
|
|
- fi
|
|
|
- fi
|
|
|
-}
|
|
|
+PATH="/bin:/sbin"
|
|
|
|
|
|
-add_to_path "/usr/local/bin/" true
|
|
|
-add_to_path "/opt/homebrew/sbin" true
|
|
|
-add_to_path "/opt/homebrew/bin" true
|
|
|
+PATH="${PATH}:/usr/local/bin"
|
|
|
+PATH="${PATH}:/opt/homebrew/sbin"
|
|
|
+PATH="${PATH}:/opt/homebrew/bin"
|
|
|
+
|
|
|
+PATH="${PATH}:/usr/bin"
|
|
|
+PATH="${PATH}:/usr/sbin"
|
|
|
|
|
|
# Additional Homebrew items that aren't linked by default
|
|
|
-add_to_path "/opt/homebrew/opt/ruby/bin"
|
|
|
-add_to_path "/opt/homebrew/opt/libpq/bin"
|
|
|
+PATH="${PATH}:/opt/homebrew/opt/ruby/bin"
|
|
|
+PATH="${PATH}:/opt/homebrew/opt/libpq/bin"
|
|
|
+
|
|
|
+PATH="${PATH}:${HOME}/.scripts"
|
|
|
+
|
|
|
+export GOPATH="${HOME}/.go"
|
|
|
|
|
|
-add_to_path "${HOME}/.scripts"
|
|
|
+PATH="${PATH}:${GOPATH}/bin"
|
|
|
+PATH="${PATH}:${HOME}/.gem/bin"
|
|
|
+PATH="${PATH}:${HOME}/.cargo/bin"
|
|
|
+PATH="${PATH}:${HOME}/.poetry/bin"
|
|
|
+PATH="${PATH}:${HOME}/.rvm/bin"
|
|
|
|
|
|
-add_to_path "${GOPATH}/bin"
|
|
|
-add_to_path "${HOME}/.gem/bin"
|
|
|
-add_to_path "${HOME}/.cargo/bin"
|
|
|
-add_to_path "${HOME}/.poetry/bin"
|
|
|
-add_to_path "${HOME}/.rvm/bin"
|
|
|
+# Run `path_helper`, and make its entries appear last, to preserve path ordering
|
|
|
+if [ -x /usr/libexec/path_helper ]; then
|
|
|
+ oldpath="${PATH}"
|
|
|
+ eval `/usr/libexec/path_helper -s`
|
|
|
+ PATH="${oldpath}:${PATH}"
|
|
|
+fi
|
|
|
+
|
|
|
+# Remove duplicate entries
|
|
|
+typeset -U PATH
|
|
|
|
|
|
export PATH
|
|
|
|
|
|
@@ -85,8 +109,8 @@ alias c="clear && NEW_LINE_BEFORE_PROMPT=0"
|
|
|
alias clear="clear && NEW_LINE_BEFORE_PROMPT=0"
|
|
|
|
|
|
#python
|
|
|
-alias python="python3.13"
|
|
|
-alias py="python3.13"
|
|
|
+alias python="python3"
|
|
|
+alias py="python3"
|
|
|
|
|
|
#granted
|
|
|
alias assume=". assume"
|
|
|
@@ -112,4 +136,6 @@ yarn() { unset -f yarn; load-nvm; yarn "$@"; }
|
|
|
################################################################################
|
|
|
# Private or system-specific environment variables
|
|
|
################################################################################
|
|
|
-source $ZDOTDIR/.zshenv.private
|
|
|
+if [ -f $ZDOTDIR/.zshenv.private ]; then
|
|
|
+ source $ZDOTDIR/.zshenv.private
|
|
|
+fi
|