-### lang
-export CHARSET=${CHARSET:-UTF-8}
-export LANG=${LANG:-en_US.UTF-8}
-
-### path
-# NOTE: we utilize the fact that unique arrays keep the first occurrence and
-# remove any further occurences to capture elements from the old PATH
-# that we did not anticipate and shift them to the front, since they are
-# probably important to the system
-if [[ ! -v _sev_setup_path || -o login ]] {
- typeset -U path fpath
- # add as many generic paths as possible to keep the order we want
- # NOTE: /usr/{local,pkg,games} are unix/bsdisms
- # XXX: PREFIX not validated, non-posix but Termux uses it, maybe others
- # XXX: XDG specifies ~/.local/bin as the only user-writable dir for
- # executables, but we specify more; technically this is against spec
- syspath=("$path[@]")
- path=(~/{.local/,}{s,}bin
- {~/.local,{$PREFIX,}{,/opt,/usr{,/local,pkg}}}/sbin
- {~/.local,{$PREFIX,}{,/opt,/usr{,/local,pkg}}}/bin
- /usr/{X11R{7,6}/bin,games})
- ((len=$#path))
- path=("$path[@]" "$syspath[@]")
- # remove nonexistent and duplicate paths
- for (( i = 1; i <= $#path; i++ )) {
- if [[ ! -e $path[$i] ]] {
- path[$i]=()
- ((i <= len)) && ((len--))
- ((i--))
- continue
- }
- }
- # shift valid system paths to the front if there are any left
- ((len > 0 && len < $#path)) && path=("${(@)path[len + 1, -1]}" "${(@)path[1, len]}")
- unset syspath len i
- # include our zsh dir in fpath. unlike above, we always prefer our paths
- fpath=(${ZDOTDIR:-~/.zsh}/functions/{*,Completions/*}(N) "$fpath[@]")
- # FPATH is not exported by default
- export FPATH
- typeset +U path fpath
- export _sev_setup_path=
-}
-