From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17837 invoked by alias); 13 Sep 2016 00:24:22 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21884 Received: (qmail 18310 invoked from network); 13 Sep 2016 00:24:22 -0000 X-Qmail-Scanner-Diagnostics: from mail-pf0-f172.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.192.172):SA:0(0.0/5.0):. Processed in 0.781716 secs); 13 Sep 2016 00:24:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at brasslantern.com does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=gtmYpaefSn1MdGSKCb5Kn0vOssaoX/rELv8cV8WRQm4=; b=Bi5bZARkXcWRPyC77tDl24JXp2rsdx405/oQ6E6kOjJkb6kN28OP2zA9KiJNu0oqmR wcnh+/Bv+HqxxQ0uCyxA9xLxmilvIzefICLnGjgnSm+IbCBSbV3EGUbOrH91EdvH7uSb ROX8tNaCgaRIYS2ab6YurRbbuj9r4yGnhwS/TUkqGWJHn4oZZYEl4h5LsXfb3Ev+dHyB L3tDXsVtcszvYSrHlBvIs0iPf1ZqEPa/tZc1loxd5bT96ocKvnxsDroGUAaxYVWse09u tQJhS3+2iehhunyICLVjQ+MDYAB/+CKOmeKG2GD7utagVOKAs4sczPswDltw2fvQehhf YVWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=gtmYpaefSn1MdGSKCb5Kn0vOssaoX/rELv8cV8WRQm4=; b=TX6K1Jc3d3lenotwJWCG33cCxtrursoAmfX4mPR8B/DVhOOdxAMNu3+4x45WvfiAyS 8LCFJSVkdhT0X7vEnnK37D4/pXvj8xaRQKfk50/T1ncb3lLod5j+X3JwdTAFT35f9aFy RfWYmTiNGYL1gcvqU230nb9br2TtizoeAB4gB7K9Oynp/0CYe3HjP3peY9/el6eBIWNZ eao1wML0iNPR5Sb2ghfe3OQn5623zZv6Z9L/dS74zkJyKDCv306Qmr1/M1UaD3OuUnya NbUQ5hPt2iyVrBtLrOU2ND0SAeINlW4Zf+oEreD6gnHPNiPIF0Q0BiTIE6Tk5ugc5G6q +dWg== X-Gm-Message-State: AE9vXwNliNKojl6huNY2ul5t00A+re0ihimeECM6LJfDevgBlqvnTaP1wiwQrTbdm+x1Tw== X-Received: by 10.98.62.194 with SMTP id y63mr16837122pfj.99.1473726253612; Mon, 12 Sep 2016 17:24:13 -0700 (PDT) From: Bart Schaefer Message-Id: <160912172421.ZM26209@torch.brasslantern.com> Date: Mon, 12 Sep 2016 17:24:21 -0700 In-Reply-To: Comments: In reply to Jesper Nygards "Re: Ignoring current directory with auto_cd" (Sep 12, 9:43pm) References: <160912102321.ZM24807@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: Ignoring current directory with auto_cd MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 12, 9:43pm, Jesper Nygards wrote: } } [...] I have "zstyle ':completion:*:cd:*' ignore-parents parent pwd" set } [...] } However, if I only type "../s" (at the beginning of the command line), } "src" will be one of the alternatives offered by completion. I realize this } is because the completion system cannot know that it should exclude the } current directory. Actually it's not because the system doesn't know it should exclude the current directory -- it's because the system doesn't know if you're intending to type the name of a directory, or if you are intending to type the path to a command file that happens to be inside some ../s* directory. In that word position, it has to complete both directory names and command names, and the latter might include a relative path as a prefix. } So my question was: can I use something similar to the zstyle for cd } completion to always exclude the current directory in such a situation? If you never want to complete the path prefixes of non-absolute command name paths, you can do this: zstyle -e ':completion::complete:-command-::' tag-order \ '[[ $words[CURRENT] = */* && $words[CURRENT] != /* ]] && reply=( commands executables builtins functions aliases suffix-aliases reserved-words jobs parameters - )' This will complete all the usual things in command position except that commands and executables are normally further subdivided by _files into globbed-files, directories, and all-files, which the trailing "-" will force to be excluded. You can get fancier with the conditional expression, e.g., check for $words[CURRENT]*/**/*(*) finding something, or some such.