zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: File completion with **/ (with solution)
Date: Wed, 21 Sep 2016 13:30:51 -0700	[thread overview]
Message-ID: <160921133051.ZM3481@torch.brasslantern.com> (raw)
In-Reply-To: <160920223246.ZM862@torch.brasslantern.com>

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


  reply	other threads:[~2016-09-21 21:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21  0:56 Bart Schaefer
2016-09-21  5:32 ` Bart Schaefer
2016-09-21 20:30   ` Bart Schaefer [this message]
     [not found] <160920175623.ZM32730__25904.0603101768$1474419485$gmane$org@torch.brasslantern.com>
2016-09-22 21:12 ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160921133051.ZM3481@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).