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=-1.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17733 invoked from network); 4 Sep 2020 19:24:10 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 4 Sep 2020 19:24:10 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1599247450; b=cFFtmCFdWBBzFgWojPIN3REXqFT3I1K0kUDCY9MTmu39Lu9sIgk2DNE8KW+CgqvJGuormECEw+ oQgU4iDmmX3H5kLt4lW/WI8e98+wbzs1okKTkd0TJJ6hbuS/gpA4oX34c6CQYVZczafF54lska xAnt5GhTHk/K4M4UF2IDOr6x9cM2t/5sz0QDFYZSshJ2djJ/On9W2koZcQFyrBFiS7/vdi0mRy iowHvc6S7RbGu9sZGby0DvgumV27LGJ/TSUGZSz+u3bJR6O81qc92sKEtN7E+rOYrPUDNMv+Ux kiHXqs3Og0GgoBmYaPShDW2r+nsGTRFxrAS0J05DASXYfQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out3-smtp.messagingengine.com) smtp.remote-ip=66.111.4.27; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1599247450; bh=JFWUMCbx/z2Zi81c7zENz4GtE/LHJufIl060iQiN6tE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=yXoltTPzEV8ArL549toeT5UNisEfsBs5mlNeEygaKf5aJQ/cwVD4wZ20QM6tffkaRnY4UdnzPo l/BAWjHNZT7vWAATTUVchBd19rqk2y+I8XGcsefBkfB4Ua7FssWdTGHP4ktfkocHQx0Pvcx5jI sbUP+QRHAtpHD7XW8+ybH2/c4WNUwMaeGT3tTP4Z/PWUXk5fLY31ob3nfPONM107VIt1FDwfBm 2X2fYY0SqTtJql0Sm0UdeWbuKh3gsRULMIDdyNBdKujWcSdD2m2Si7tIu8U7loKT8KptfbdGuz 4/jUdsuH1Kcz5ZUDpZdQmofZL7/aJfHcZ69NFz8SoIj+cg==; 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-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=qBhlh02LERehkSuLwVQsD1xp3NKY8ekZWjOdYAGQ9NE=; b=piT6fCsbciIbzE9VdYPktqE9OX yLml/egGNt7gzWTpBA4YSm5+L9T+Qq/ztGHd5RwPm9IgnuNjTAG2oqlj+0XWrDer/JM7M8hx1ToZF mQs0T8rQeQ1gXknugziwyzBQh4EORD2oaXOMv+8SkLaf7hQrLwDmvITrtp60kB3WidOxcU31iuazu p7pFTA5IyqFVKUE2MoKsrxAGqoqEAjEE9n1qXU41hnOmsi8kG8slIDoj/fNSVi4s2iK1zDPPyE03v wKQGfIv4dUVR3dP/AubKiRoK0K4hD72MxttuyisNX6iBM53ehyKiEAX41Hmi1wB4kqO+AIfwV8Tcc 4O2m7aWQ==; Received: from authenticated user by zero.zsh.org with local id 1kEHJf-0000ba-Vx; Fri, 04 Sep 2020 19:24:08 +0000 Authentication-Results: zsh.org; iprev=pass (out3-smtp.messagingengine.com) smtp.remote-ip=66.111.4.27; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out3-smtp.messagingengine.com ([66.111.4.27]:43203) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kEHJ8-0000Eq-Jr; Fri, 04 Sep 2020 19:23:36 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EB2BF5C0152; Fri, 4 Sep 2020 15:23:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 04 Sep 2020 15:23:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=fm1; bh=qBhlh02LERehkSuLwVQsD1xp3N KY8ekZWjOdYAGQ9NE=; b=aPx+87BgbfteOqAMlOMnHlrZEiibz49dXyS+ttmvG1 eiTSxJQmRjAzfQwK0W5sKf21fVfEJuOW3WIWqhpyk5km+FRA7s+5xB8e1UPcZqF4 UkorvyjoYOfmXOgNcwSKKWju8XXrfe39yTkB5nWGHYhliA9wc16JLTaHeigBjmnd lo2aD8pkjYDWn9uKhX0VkN8xQ+Fkiszz0I83TJ1TLESlT/1kgOeawrfcOlKMM+Ue GUhkTHys6Xv36jM00Wuakduh784+YIVeRwVqbQaBjpdzA+ffpMHLlevGuU5UJ2t5 1TKzYUeyfFF/gXsjC/lC3c67tpiGzQLMAbTkjP325uLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=qBhlh02LERehkSuLwVQsD1xp3NKY8ekZWjOdYAGQ9 NE=; b=opqg0JM4MIA+UbEsrkrzzpL1gzeuW8Qln1D23CYhqYKSt0bDECWx340LL ck3NS6ELZkVQgr8aAsAk8kaTpT7rzRdAtFd4woI3VATvPX6ikzoYpQXZjLWlvgt2 QhjE6SjSgxyyFir3u06RuxGvWptpRGSPrlfeo63dtMJBSzjBNM6jqPuFOgo/El3E NWgPJMFjTPD/T8P9d/BESjBrDZBTKc+83KpIVbEGYNMWTF1DxajdChaBKpn+SqTn O6n1dwmwHWx1aM+ixR9C0m+W6vJoxU63JLpqthAe24AGj7PbQie6q5K1DdYOX13E 5nEGBlQ9q7e5QUBZ7QcFULMwHrDsQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegfedgudefjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkjghfofggtgfgsehtqhdttdertdejnecuhfhrohhmpeffrghn ihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpefhueehvdfhtdfhvdevtdevkefhvedutedvfffhudehgfei geefhfelveefhfeivdenucffohhmrghinhepvgigrghmphhlvgdrohhrghenucfkphepje elrddukedurddurddvtddvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-79-181-1-202.red.bezeqint.net [79.181.1.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 2E9D6306005B; Fri, 4 Sep 2020 15:23:33 -0400 (EDT) Received: from tarpaulin.shahaf.local2 (localhost [IPv6:::1]) by tarpaulin.shahaf.local2 (Postfix) with ESMTP id 4Bjndv2jx5zGh; Fri, 4 Sep 2020 19:23:31 +0000 (UTC) Date: Fri, 4 Sep 2020 19:23:29 +0000 From: Daniel Shahaf To: Peter Stephenson Cc: Ahmad Ismail , zsh-users@zsh.org Subject: Re: how to use tags in zsh completion system Message-ID: <20200904192329.08f436ea@tarpaulin.shahaf.local2> In-Reply-To: <441849700.1433895.1598439442873@mail2.virginmedia.com> References: <441849700.1433895.1598439442873@mail2.virginmedia.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Seq: 26051 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: Elaborating per the request in users/26049. Peter Stephenson wrote on Wed, 26 Aug 2020 11:57 +0100: > > Please help me understand how to use tags in zsh completion system. =20 >=20 > Just off the top of my head (other people may have their own favourite > examples), one interesting command with a number of different tags > that apply at the start of completion is scp: ^xh for that gives me >=20 > tags in context :completion::complete:scp:: > argument-rest options (_arguments _ssh _ssh) > tags in context :completion::complete:scp:argument-rest: > files hosts users (_ssh _ssh)=20 > globbed-files (_files _ssh _ssh)=20 > hosts (_hosts _combination _ssh_hosts _ssh _ssh)=20 > users (_users _combination _ssh_users _ssh _ssh) >=20 > so that might be something to play with. The scp(1) command can be invoked in several different ways: . scp $localfile ${remotehost}: scp $remoteuser@$remotehost: $localfile scp ${remotehost}: $localfile . Thus, =C2=ABscp =C2=BB completes three kinds of things: local files, usernames for remote login, and hostnames for remote login. =20 The completion system knows what type of thing each possible completion is. Each tag=C2=A0=E2=80=94 in this example, "files", "hosts", "users", and "globbed-files"=C2=A0=E2=80=94 corresponds to a single "type o= f thing" that can be completed at that point. (I'm not sure how "globbed-files" gets there, but you needn't worry about that right now.) You can see completions grouped by tag by setting the group-name style: $ zsh -f % autoload compinit % compinit % zstyle :completion:\* group-name ''=20 % zstyle :completion:\*:descriptions format '=E2=86=92 %d'=20 % scp =E2=86=92 file bar.txt foo.txt =E2=86=92 remote host name hermes.example.org localhost =E2=86=92 user danielsh root You can reorder the three groups of candidate completions by setting the tag-order style appropriately. For example, =C2=ABzstyle \* tag-order users hosts files=C2=BB will show the groups in a different order than above. Tag names are also part of the zstyle context string (the thing context patterns are matched against), so styles can be set for some tags but not others. For example, =C2=ABzstyle ':completion:*:options' prefix-hidde= n true=C2=BB will set the prefix-hidden style whilst listing candidate completions that are options, but not whilst listing other candidate completions. As Peter said elsethread, you can generally forget about tags unless you're either configuring completion system or writing your own completion function (which you wouldn't generally need to do, unless you wrote a custom command as well). Cheers, Daniel