From: Thomas Ballinger <tom@hackerschool.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-users <zsh-users@zsh.org>
Subject: Re: custom script Bash completion
Date: Sun, 10 Nov 2013 14:09:50 -0500 [thread overview]
Message-ID: <CABb6=DUEE3Zf_z2+bK65oSCuA7fq=SigPqt0Q+2b+5ge1YLrkw@mail.gmail.com> (raw)
In-Reply-To: <131110102458.ZM21475@torch.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 2243 bytes --]
Thanks very much Bart,
I'm now using
tu_completer(){
IFS=$'\n' # in loop below, iterate over lines, not words
for name in $(tu --get-bash-completion "$@"); do
echo $name
done
}
because some of the suggestions contained spaces, and functionality is
improved. However, completion suggestions are still filtered though by
"values that the user has typed the first letters of," preventing the fuzzy
completion I'd written from taking effect:
tu comment jorge<tab>
should result in
tu comment George Washington
or
tu comment jorge
George Washington Fred Jorrge Elizabeth George
if there are multiple options, but they don't - no suggestions show up.
(apparently because none of the suggestions returned by my completion
script/function start with "jorge")
tu comment Geo<tab>
works fine. I imagine I need to turn off some zsh completion feature for
this completion?
Tom
On Sun, Nov 10, 2013 at 1:24 PM, Bart Schaefer <schaefer@brasslantern.com>wrote:
> On Nov 10, 11:14am, Thomas Ballinger wrote:
> >
> > I'd like to use bash completion in zsh for a script with
> >
> > complete -C 'tu --get-bash-completion' tu
> >
> > 'tu --get-bash-completion' is invoked by zsh completion, but the three
> > arguments bash would pass to it aren't being passed.
>
> I'm not absolutely sure if the following explains that, because none of
> the bash man pages I can find describe what those three arguments are,
> but: The zsh bash completions are compatible with bash 2.05b and it is
> possible that those three arguments were not passed by that version.
>
> Volunteers to update Completion/bashcompinit?
>
> > Is there another config option I need to know about, or is this behavior
> > not implemented?
>
> Based on a quick peek at "compgen" in bashcompinit and a couple of stabs
> with "complete -C /bin/echo foo" in bash itself, Thomas is expecting the
> external command defined with "complete -C" to receive the same three
> arguments that are passed to a shell function with "complete -F".
>
> So the workaround for this particular anomaly is to do
>
> tu_completer() {
> echo $(tu --get-bash-completion "$@")
> }
> complete -F tu_completer tu
>
next prev parent reply other threads:[~2013-11-10 19:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-10 16:14 Thomas Ballinger
2013-11-10 18:24 ` Bart Schaefer
2013-11-10 19:09 ` Thomas Ballinger [this message]
2013-11-10 20:25 ` Bart Schaefer
2013-11-10 21:34 ` Thomas Ballinger
2013-11-10 23:18 ` Chet Ramey
2013-11-11 2:12 ` Bart Schaefer
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='CABb6=DUEE3Zf_z2+bK65oSCuA7fq=SigPqt0Q+2b+5ge1YLrkw@mail.gmail.com' \
--to=tom@hackerschool.com \
--cc=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).