Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _tilde
- X-seq: zsh-workers 6642
- From: Tanaka Akira <akr@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: _tilde
- Date: 16 Jun 1999 00:34:22 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
I modified _tilde to complete numbers after ~+ and ~-.
How about this?
--- Completion/Base/_tilde- Wed Jun 16 00:24:35 1999
+++ Completion/Base/_tilde Wed Jun 16 00:32:40 1999
@@ -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[@]"
--
Tanaka Akira
Messages sorted by:
Reverse Date,
Date,
Thread,
Author