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=-4.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5962 invoked from network); 30 Dec 2020 16:45:43 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Dec 2020 16:45:43 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1609346743; b=aFKfK8ooxNNJSPIPdXFLJ8dwed1/fGSCTiRwmWI0FjoBiV0rWX+KrEIriiS9/bxXOTbrqS3846 yUPZ05Pqk2gOJCVqTAc5iXA4hk48nG6AlZcNOv5p75U5iW62BSaQNivizthm0uRkOAGD8joF8u jgpw3I/IG/CSZWofj1SnsZYyf1nWR7Hxz2+5jGfDGkknjJd3boOvPwUQ3BDBpXM1SgLkWu//vj ax62GSRVoqWktjmTV3rqeRDm6ALTtKXbgbRNyie6P9fIkipWtQfmFVIfUje3vfbf4AGr20eEXU AcF5nLgh9islbMGTtjsuNjOD9x75VZO0ODG4msRDq1xI/w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1609346743; bh=PZ3EWC3Fvq6IIxAnS6WxscS8YitSiCW/Avk6wIJrV3Y=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:DKIM-Signature; b=pa4vQkKmV1lZlnXnUF1bogpoYsmOyH1Wa3xvNejQPKmfI2HI5B3GG6181z6yvafYVteOBzpxzC uBTC2eTYrjnEO1m83XE/MfbtG6HJ4YEkMLy28jzUP7CJstodcHwzd+LAai2jKobSQD2QsDm0fV wn+X4XOChhxiJmdbkt6pASMTOIVJ+t6AtsejIHWKcgRxF26irCJHM5InjMdU61VhTXTAnThMT/ EsymQAz3T7ukszctEe61ge8eCcPzy0sSqDII6xZNyBKESIm6aIDNemGT7SCNhQGtmBLne9Z9AX NGhACYx4i1CsXYkPVOZIwYCQG2aXU0DPEP+Y7pLIVMaH/A==; 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:In-reply-to:MIME-version:Date:Message-id:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=t0aKjuP/b1e3zjk9TjCpHS3aooyIKaFYIcd0cM0iVMs=; b=M9ABmophdcbylsgQ6y4Z6zqLFa ycE3YlVw6WA09JAjBEmHbFFPzBm+WfkgWkW5EectV1UAI4CXudtmveOdKBv7S6W1qLuuQNTX0RQqi 9WZY+TTv6Nv9ljKpqw2AbGkH0swSylmeknuGO6zsMmaNLfOZbYVFoi5OvTlErRi42yNBX7+iQTv6r wtDK9WSf1piBRLXLKWCHqZbxrHybPgbzZx36LkdXA36AFMO+8B5R3D5nz8OWefaH/h3lOoYXhldyN qLzGvA43KqW/0FnEgpmx2qMtz4ZXkl3Gl/D+j/cmfOBIfQRKBmctBcSwWpdS3apuMF+c75LelB4du UoVK6vPA==; Received: from authenticated user by zero.zsh.org with local id 1kuebQ-000JaS-0Y; Wed, 30 Dec 2020 16:45:36 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:41244) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1kueay-000JDB-TC; Wed, 30 Dec 2020 16:45:09 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0QM500LVGV52RCX0@mta02.eastlink.ca> for zsh-users@zsh.org; Wed, 30 Dec 2020 12:45:06 -0400 (AST) Received: from [192.168.0.2] ([24.207.90.194]) by Eastlink with ESMTP id ueawki0H9eJNSueawkUzgb; Wed, 30 Dec 2020 12:45:06 -0400 X-Authority-Analysis: v=2.4 cv=Aat0o1bG c=1 sm=1 tr=0 ts=5fecae92 a=zv49KfEsxEDzuN5AGO7r0Q==:117 a=zv49KfEsxEDzuN5AGO7r0Q==:17 a=IkcTkHD0fZMA:10 a=09900VtP6fxuCrwxi-0A:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddvfedgleefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepkedvueeuffefhfdvueeiteffvddtvdejgeeujeekieduheeiteeiheegtedvhfefnecukfhppedvgedrvddtjedrledtrdduleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdeltddrudelgedphhgvlhhopegludelvddrudeikedrtddrvdgnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrgh X-Vade-Score: 0 X-Vade-State: 0 X-EL-IP-NOAUTH: 24.207.90.194 Subject: Re: completion within a function To: zsh-users@zsh.org References: <819ec6fe-5af2-2e97-c5bb-f434b1de86d7@eastlink.ca> <520ce98a-4394-726d-3d12-8ef414e881c9@eastlink.ca> From: Ray Andrews Message-id: Date: Wed, 30 Dec 2020 08:45:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 8bit Content-language: en-US X-Seq: 26272 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: On 2020-12-29 8:34 p.m., Roman Perepelitsa wrote: > > Where and how do you want to invoke this code? In a function named 'c'.  It's my one stop shopping wrapper around 'cd'.  Mostly it offers a zcurses based (thanks Sebastian) selection of previously visited directories from a persistent, global directory stack , but the code I just added (thanks Bart) now gives me this pseudo completion like this:     8 /aWorking/Zsh/Source/Wk 4 $ c N-  # I could have just pressed TAB here to complete.     Changing to N-functionsWorking ...     8 /aWorking/Zsh/Source/Wk/N-functionsWorking 4 $                              7:25AM Wed 30 ... So before offering a zcurses selection from the directory stack, it now attempts what would be almost exactly the same as:     $ cd N- [TAB] ... Bart's code just globs " N-* " so " N-functionsWorking " is found automagically.  It's sorta better than TAB anyway because there will be no mysterious completions.  Also actually using TAB on the command line sometimes gives you several possible completions but as I have it, if there's only one match it just 'cd's' there, if not, you get the zcurses selection window.  (And of course I still can complete using TAB if I feel like it anyway, that option remains.)  I quite love my 'c' wrapper, life was solitary, poor, nasty brutish and short without it. So the idea of invoking completion within a function is now a matter of curiosity  only.  Still I'm surprised it can't be done.  It's one of those things where zsh smartness is hard to turn off. Here's a real life example of 'c' being elegant.  Where the hell are my zsh distribution functions? 8 /aWorking/Zsh/Source/Wk 4 $ c ,a Functions zsh Searching entire system for directories matching:  "Functions" "zsh" (case INsensitive, WILD) ... Changing to /aWorking/Zsh/Zsh-5.8/share/zsh/5.8/functions ... 8 /aWorking/Zsh/Zsh-5.8/share/zsh/5.8/functions 4 $   # Sweetly found.