VCS_INFO_realpath () { #{{{ # a portable 'readlink -f' # forcing a subshell, to ensure chpwd() is not removed # from the calling shell (if VCS_INFO_realpath() is called # manually). ( (( ${+functions[chpwd]} )) && unfunction chpwd setopt chaselinks cd $1 2>/dev/null && pwd ) }