Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: More-verbose tab-completion idiom?
- X-seq: zsh-users 27577
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: More-verbose tab-completion idiom?
- Date: Thu, 17 Mar 2022 17:38:54 -0400
- Archived-at: <https://zsh.org/users/27577>
- In-reply-to: <CAH+w=7Y6XtGs_8k4Uw4vv2=Apo4jkR1TPxOpTEGYAyz_8TfRGA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc
- References: <YjKATMd5ifSGX7eD@fullerene.field.pennock-tech.net> <CAH+w=7ahY_spSUq=PqgtD1Kv6j_qQeYC_eNcaucz1_r1KUZf=w@mail.gmail.com> <YjKbOBHSJ++JZhH2@fullerene.field.pennock-tech.net> <CAH+w=7Y6XtGs_8k4Uw4vv2=Apo4jkR1TPxOpTEGYAyz_8TfRGA@mail.gmail.com>
On 2022-03-17 at 13:44 -0700, Bart Schaefer wrote:
> Are the key-value pairs at least all on one line each? Just choosing
> a json file that's lying around on my Ubuntu:
Yes, yes they are.
For now. And I'm in a position to chat with the tool maintainer and try
to make sure they stay that way.
> json2hash () {
> zmodload zsh/mapfile
> setopt localoptions extendedglob
> # Might have to undo gmail line wrapping here
> typeset -gA $1=(
> ${(z)${(@)${(f)mapfile[$2]}:#[{}]}/(#b)([^:]#):(*)/${(Q)match[1]}
> ${(q)${(z)${match[2]%,}}}} )
> }
> json2hash scopes /usr/share/unity/client-scopes.json
> typeset -p scopes
Switching from `jq` to this:
described_contexts+=("${nctx//:/\\:}:${${${${(@M)${(f)mapfile[$nats_ctxdir/$nctx.json]}:#[[:space:]]##\"description\":*}#*: \"}%,}%\"}")
means that the time to complete, across 35 files, drops from "a few
seconds where things appear to have hung" to "faster than I can notice",
so I am going to publish a version using this, and most of Daniel's
suggestions, in a few minutes. I just have to switch from
"extra-verbose" to "verbose" simply because of the difference in
overhead now.
Thank you!
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author