# Zshrc function definitions # {{{ check for version/system # check for versions (compatibility reasons) is439(){ [[ $ZSH_VERSION == 4.3.<9->* || $ZSH_VERSION == 4.<4->* || $ZSH_VERSION == <5->* ]] && return 0 return 1 } #f1# are we running within an utf environment? isutfenv() { case "$LANG $CHARSET $LANGUAGE" in *utf*) return 0 ;; *UTF*) return 0 ;; *) return 1 ;; esac } # check for user, if not running as root set $SUDO to sudo (( EUID != 0 )) && SUDO='sudo' || SUDO='' # autoload wrapper - use this one instead of autoload directly # We need to define this function as early as this, because autoloading # 'is-at-least()' needs it. function zrcautoload() { emulate -L zsh setopt extended_glob local fdir ffile local -i ffound ffile=$1 (( found = 0 )) for fdir in ${fpath} ; do [[ -e ${fdir}/${ffile} ]] && (( ffound = 1 )) done (( ffound == 0 )) && return 1 autoload -U ${ffile} || return 1 return 0 } # Load is-at-least() for more precise version checks # Note that this test will *always* fail, if the is-at-least # function could not be marked for autoloading. zrcautoload is-at-least || is-at-least() { return 1 } # }}}