1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-06-15 08:28:03 +02:00
This commit is contained in:
Tanaka Akira 1999-06-26 05:22:41 +00:00
parent a2159285e8
commit fe43e0dae0
2 changed files with 26 additions and 4 deletions
Completion
Base
User

View file

@ -7,10 +7,32 @@
# `(( compstate[nmatches] )) || compgen -nu -qS/'
# below that.
local c s dirs list
if [[ "$SUFFIX" = */* ]]; then
ISUFFIX="/${SUFFIX#*/}$ISUFFIX"
SUFFIX="${SUFFIX%%/*}"
compgen -nu -S ''
s=(-S '')
else
compgen -nu -qS/
s=(-qS/)
fi
if compset -P +; then
dirs="$(dirs -v)"
list=("${(f)dirs}")
[[ -o pushdminus ]] && dirs="$(awk '{ $1 = '$#list' - $1 - 1;
printf("%s\t%s\n", $1, $2); }' <<<$dirs)"
list=("${(@)list% *}")
c=(-y '$dirs' -k "($list)")
elif compset -P -; then
dirs="$(dirs -v)"
list=("${(f)dirs}")
[[ ! -o pushdminus ]] && dirs="$(awk '{ $1 = '$#list' - $1 - 1;
printf("%s\t%s\n", $1, $2); }' <<<$dirs)"
list=("${(@)list% *}")
c=(-y '$dirs' -k "($list)")
else
c=(-nu)
fi
compgen "$c[@]" "$s[@]"

View file

@ -1,4 +1,4 @@
#compdef make gmake pmake
compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print \$1}' FS=: [mM]akefile /dev/null)" ||
_files
compgen -s "\$(awk '/^[_a-zA-Z0-9][-._a-zA-Z0-9]*[^\/ ]+:/ {print \$1}' FS=: [mM]akefile /dev/null)" ||
compgen -f