Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: File completion with **/ (with solution)



On Sep 20, 10:32pm, Bart Schaefer wrote:
}
} There's a typo above; should be
}    zstyle :completion::user-expand::: tag-order expansions all-expansions
} 
} I'm not sure why there are fewer colons in user-expand than in tag-order.
} I think there's a similar typo in _user_expand looking up that style.

There's an additional bug in _user_expand that breaks tag-order when
there is exactly a single match.  I think the -gt test (see diff) was
expecting $exp[1] to be the original input pattern and wanted to skip
that, or something.

I'll apply the patch below to make the above tag-order work in zsh 5.3,
but for all prior versions you'll have to do:

zstyle :completion::user-expand::: tag-order 'expansions all-expansions'


diff --git a/Completion/Base/Completer/_user_expand b/Completion/Base/Completer/_user_expand
index cf3d172..066e2e8 100644
--- a/Completion/Base/Completer/_user_expand
+++ b/Completion/Base/Completer/_user_expand
@@ -27,7 +27,7 @@ exp=("$word")
 
 # Now look for user completions.
 
-zstyle -a ":completion:${curcontext}" user-expand specs || return 1
+zstyle -a ":completion:${curcontext}:" user-expand specs || return 1
 
 for spec in $specs; do
   REPLY=
@@ -95,7 +95,7 @@ if [[ -z "$compstate[insert]" ]] ;then
 else
   _tags all-expansions expansions original
 
-  if [[ $#exp -gt 1 ]] && _requested expansions; then
+  if [[ $#exp -ge 1 ]] && _requested expansions; then
     local i j normal space dir
 
     if [[ "$sort" = menu ]]; then



Messages sorted by: Reverse Date, Date, Thread, Author