From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1964 invoked from network); 18 Oct 2020 22:00:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 18 Oct 2020 22:00:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1603058433; b=SU1rJvRFiGuMFxlfWLAcpazUB8FAk6keMMPUk/WXWR1XhZn6xTlL/56jaD+KT5dLGWctISPVUs 9fSvUPp3EDTBKz6wtkjVKApX98b9CTU11jQCgz8qn+OdPvwhTDwIx7y3g9Gg7xHj6qYTFPs7Qj WvqcGrzTDRZT3yytef3KBFmC6ahV3TzrZl7QiI9pTWYJWdvVGjKilFn3uK/e17Z0cA/ZRf28RG yCBIXiIVW6xbY0yoLYX63ZGxQWtkGztocrM+csHY5DlXE6Y7vy1bJPwzxx6M6LG+n7Bcf9easz ZxgkM/ZBSu6CLq0NlIojaYWJTn2KQxhFjJuhJIzsYf2YQg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oo1-f49.google.com) smtp.remote-ip=209.85.161.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1603058433; bh=4dp47wBJriKdSSz+fmjHqMXyQAjpcs63hS1hOGCi75E=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=nfASg0CKLIzGti74C3ZJ0Ek+WS2Xz1zaOt4ky2QZrIg3Uh/8/dbXG3ByHB/wgG+yApJ3q9PPnb fY2tLhPPDY2ArUtdQ+kXDg/lEe2Qct6fihkOa9DxzU29M3QdvyeKoECGvfYzzhjmOxsWG/CBWC NfzoOR5ghWZBCRhHrHXLfWDk+OzFJm+XHiEDq72BezWYNHftz1wPseTkv+HMgM3B184hkw74f1 5vDzFxq3w6s/hKJD23GdVMXHaGJqioMfF2xmVIYHpAjG+Il0Dws8gjeHi9OrT/DNKZTZk8Bkvy sJ71YxyGukVJPRn24jB/7sAQsKfNkEw6YqTV70V7pLXVoA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=eaInjCElZKGF4K9PjsbQL8MaV36wD6o0WhyCfIIENhQ=; b=aLj4u0rEmjKty2jZYZqXEfEIXn laSR9nOxK59zMgfX2fndrQ0vW5Ry0r/EuiantIhPB2xQFfyL4d2uw12TzLylH6Fu7M2+43+/dUAIw PlyCeu30LGzQef7KFIfUSyUFLMrqXzOrrowETXvo52BDeliOlq1uXrsuiODA6f49nlgZdaOffwJwN +N6oav2l8IoEImLdY/cY7J2wV+8U04JjbZCDlKtl1apxa7XO6He/K0hT5AJYlhBuDruMK5tZYVdx0 JXHqiJkyrJ0VJ6HQWeYyg00N+RViBoC52DlLJt/8OBZKWNZ8h3MoJXOhC4FEzZzEqrJAnrJ4O0L2Y +6QcRVKw==; Received: from authenticated user by zero.zsh.org with local id 1kUGjA-0008wO-Cs; Sun, 18 Oct 2020 22:00:32 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oo1-f49.google.com) smtp.remote-ip=209.85.161.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oo1-f49.google.com ([209.85.161.49]:38102) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kUGic-0008Y3-6Q; Sun, 18 Oct 2020 21:59:59 +0000 Received: by mail-oo1-f49.google.com with SMTP id v123so2330951ooa.5 for ; Sun, 18 Oct 2020 14:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eaInjCElZKGF4K9PjsbQL8MaV36wD6o0WhyCfIIENhQ=; b=LYFYtaGJxACWoXJBIsQhmU3HBZd7fs33sOBg93IhQBpzdZ7yED54jjYI0lPH5xKELE fsIgSx5trlecW1w/n3KmRavlZtYX2bY5VUz2SE5xyunJej+ni0GzbYycDiU+FU77o7qU +Dk5UKGzT/8LVU8zSohDfKXGs4VZSXv67+y1fveHIyNF21tb7gHv8gupVWrSyf8U3UiT idQH4Wg7h7ogOfBrnfASlFK9OaSnbRGfSnPI1MU3YxrCldwTKb1qy+n6TVAVBIa5n7Hd W8nNhedXxn8Nh7Gttaxc+4X85YCByyCBkZy5WvfC7FHHCNUHqrnAsUBTGumpERs1yx6h J6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eaInjCElZKGF4K9PjsbQL8MaV36wD6o0WhyCfIIENhQ=; b=EK1ywn8hOWhBITrPh+L/FFi7jl8LYm8LjpWx5OOHWGL/QnwOvwoIt3Px8viagiBaKh qr7jv/rpy+1NHZ04gPZWDX+d21O2Ect0Yacl8KgS6r7CLHaWyH0oJ+JU2RZ3RrFLoBIy /2/ZuY4tT+spfy8HGrdqxtEl4Mte0Hpc4qP4VYYUKql7+UCBNlgEsdmLZbfNY3L7njtS 4JgTM2YAtKJft8oYrB/tbsp88K6kessnQe6zgd7oM7MTaMI3guqiblQNAcYobjKIxQP9 lg3oLawcZ7kt7gOO7rR8cIQ10eqcut4C2bRoce4UWTN+0nsS2Aa+gB2ZepanH1QX3Z9d O7/A== X-Gm-Message-State: AOAM532ZtOhDvgsJc9EKmDFEokZKVnhvoJORr/GeeQwZTZRwjKWqwQAz XEd2rrg17BSIdYXNKnU5IotYQ9xYBsgPMwBGCO0T/g== X-Google-Smtp-Source: ABdhPJw8rfC8jJDO5zqn6vdwCKXvLGDwgGE2WOLdo1BgijHucE9pujaWwT+ldQJQ5sQNRqMcLr5vs+8IZeOwUv2D9fo= X-Received: by 2002:a4a:b811:: with SMTP id g17mr10349769oop.82.1603058396675; Sun, 18 Oct 2020 14:59:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 18 Oct 2020 14:59:45 -0700 Message-ID: Subject: Re: show completion description in single line To: Ahmad Ismail Cc: Zsh Users Content-Type: multipart/alternative; boundary="00000000000049d58705b1f91e2f" X-Seq: 26114 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: --00000000000049d58705b1f91e2f Content-Type: text/plain; charset="UTF-8" On Sun, Oct 18, 2020 at 11:28 AM Ahmad Ismail wrote: > [...] multiline descriptions are draining my cognitive resources. Is > there any way I can trim the description to single line. > __git_extract_aliases > > However, I am not sure how to do it actually. Being said that, a zstyle > solution will be much better for me. > In the interests of "teach a man to fish" ... If you look at the source of __git_extract_aliases you will see that it does this: tmp=(${${(0)"$(_call_program aliases "git config -z --get-regexp '^alias.'")"}#alias.}) What you are seeing in the descriptions is thus the output from that "git config" command. Your goal is to replace that with something that produces less verbose results. You've already figured out that _call_program looks up the "command" style, so you need to find the right context to pass. This is where ^X? (the _complete_help binding) comes in handy. If you type ^X? (ctrl-x questionmark) instead of tab, the completion system will dump a file in /tmp with the full set of instructions that were executed in order to generate the completion matches. You can then look through that file for the _call_program run and find the context it used. (This is what I did to find "tree-files" in the other thread, except in that case the $(_call_program ...) had stderr directed to /dev/null, so I had to first remove that redirect.) As a shortcut ... you can see from the _call_program arguments that the tag is "aliases", so you can construct a wildcard match: zstyle ':completion::complete:git*:*:aliases' command '...' Replace "..." with whatever variation of "git config" you need to produce your desired abbreviated results. If the wildcards unexpectedly match something you didn't intend, then you can dig deeper to find a more specific context. Note I didn't test the above in any way, so details may need adjustment. --00000000000049d58705b1f91e2f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sun, Oct 18, 2020 at 11:28 AM Ahmad Is= mail <ismail783@gmail.com>= wrote:

[...]=C2=A0 multiline descriptions are draini= ng my cognitive resources. Is there any way I can trim the description to s= ingle line.

__git_extract_aliases

However, I am not sure = how to do it actually. Being said that, a zstyle solution will be much bett= er for me.


In the int= erests of "teach a man to fish" ...

If y= ou look at the source of __git_extract_aliases you will see that it does th= is:

tmp=3D(${${(0)"$(_call_program aliases &q= uot;git config -z --get-regexp '^alias.'")"}#alias.})

What you are seeing in the descriptions is thus the o= utput from that "git config" command.=C2=A0 Your goal is to repla= ce that with something that produces less verbose results.
You've already figured out that _call_program looks up the= "command" style, so you need to find the right context to pass.= =C2=A0 This is where ^X? (the _complete_help binding) comes in handy.=C2=A0= If you type ^X? (ctrl-x questionmark) instead of tab, the completion syste= m will dump a file in /tmp with the full set of instructions that were exec= uted in order to generate the completion matches.=C2=A0 You can then look t= hrough that file for the _call_program run and find the context it used.

(This is what I did to find "tree-files" i= n the other thread, except in that case the $(_call_program ...) had stderr= directed to /dev/null, so I had to first remove that redirect.)
=
As a shortcut ... you can see from the _call_program argumen= ts that the tag is "aliases", so you can construct a wildcard mat= ch:

zstyle ':completion::complete:git*:*:alias= es' command '...'

Replace "...&qu= ot; with whatever variation of "git config" you need to produce y= our desired abbreviated results.=C2=A0 If the wildcards unexpectedly match = something you didn't intend, then you can dig deeper to find a more spe= cific context.

Note I didn't test the above in any wa= y, so details may need adjustment.
--00000000000049d58705b1f91e2f--