zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _tilde
@ 1999-06-15 15:34 Tanaka Akira
  0 siblings, 0 replies; only message in thread
From: Tanaka Akira @ 1999-06-15 15:34 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-06-15 15:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-15 15:34 PATCH: _tilde Tanaka Akira

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).