#autoload local i expl link sep cmd local -a fds list if zstyle -T ":completion:${curcontext}:" verbose && [ -h /proc/$$/fd/<->([1]) ]; then zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- if zmodload -F zsh/stat b:zstat; then cmd='zstat +link -A link $REPLY; link=$link[1]' elif (( $+commands[readlink] )); then cmd='link=$(readlink $REPLY)' else cmd='link=$(ls -l $REPLY|sed "s/.*-> //" )' fi # Filter out the fd for the dir opened during the glob (/proc/$$/fd) : /proc/$$/fd/<->(e,$cmd' if [[ $link == /proc/$$/fd ]]; then false else fds+=( $REPLY:t ) list+=( "$REPLY:t $sep $link" ) fi ',) if (( $list[(I)<-> $sep ?*] )); then _wanted file-descriptors expl 'file descriptor' compadd "$@" -d list -a - fds return fi else fds=( /dev/fd/<->(N:t) ) fi _wanted file-descriptors expl 'file descriptor' compadd -a "$@" - fds