#compdef ulimit [[ $PREFIX = u* ]] && compadd unlimited && return 0 local -a opts setopt localoptions extendedglob opts=( ${${${(fo)"$(ulimit -a)"}:#-N*}%% *} ) _arguments -s \ '-H[set hard limits]' \ '-S[set soft and hard limits (with -H)]' \ '-N+[specify limit by number]:limit number' \ "(-N ${(M@j: :)opts#-?} *)-a[list all current resource limits]" \ ${opts/(#b)(-?): (*)/$match[1][$match[2]]:$match[2]} \ '*:file size (blocks)'