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, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20042 invoked from network); 6 Dec 2021 04:48:37 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Dec 2021 04:48:37 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638766117; b=R/vSLKcyajsdDGt22zhJm4UBU21x9SZmRX9cMIisjSP17wKRYJ6PFR3NbcjU0ps5v6A8U2xzAG qRoJ5m6spv+RLPGja0S5DCqyC65VUJoR5ngTjKI69BhXIL6W2skI0rsZpBqwIzZwpg6Pl+NbTX w2I/N1N/aWI9IWnxBvIq18PtFSOvTzzAlsmmtpoga4DxRBMuklz6uEswKN0ZO8wJt+jKUc4Ll9 H6wEtV3WCvknU2XfCGyEoGU5YYfkq7l0uFJn5bEpz/dknymBiaJ7k/qWgCEuRrEzC/UuMobb7w 6VB7vcMlpDTD/Sk9Uw99MWHpuJpqjNGLKjJzPkYjdjuR5A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f170.google.com) smtp.remote-ip=209.85.219.170; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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-20210803; t=1638766117; bh=g48lrPgkCag/O0CVXqlyAS/PxWtwqlkgSorBl5wEchQ=; 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=pQX9+PbBqpMedBdPEMt7l8OO8EeHn73pkfRvJDj5z63EOHoPlRRYJY9Gf1CwhKfUuRpB4peY8A AwLzHhtSVAZ3i97u7y/hrUzinFH7y5mSYjZBPevDNhzmpAFoU8UFSbaYGkbRxny3rFBq4Rma7/ VSYM0O1/MTGnCUQxVhnj/bSzltLOGeP2Es+UzsHb4EU7l3vca9J7sxPnPSaFxt9/0wnRMzAx/L gXPCsBufrZPhIfc3S0g/Y70liMK1NdzCsxbp/fPtmtaplfTItv7HVyiwuWkzo/gpJZHuep4Kmj caeebIVn+xWa0zdwpjgc30DrdTgqSQMi6zFcPtRyJ1lB4g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; 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=IqidX4CHY47+HkHI14MItoFMcgp1cXc14dpcvca8Kh4=; b=CA74pRp9aQbJapLKVGC6e7Idsk /vYpJnuNIkjF5WRcMVMJEWxnmL/lp6tdF0UlyTEha4gWWBnneiXPTanyhfEgDBcoyCG9mTEpS7twm 8LjsAbq0waAf3+oDqP0CND8EKqVZLHtS7SfBKOWSDf2+kcnvJ93fCbLVfrbZWNfkLSCc2DVOYNTRj ZevT9EtKBG7c74Rgvdgdr6hizVEkLm9tWgKLiBDhPK9DvyahXtN1uwHqDKt2g3IDHlvYtlzQt32o7 1nf8enl0eMJCYxf9ZpVwC+L41SqSkPHXUat0j1Wh+HZCLH3TKrvGx7peomr35PvXWAYvQepbl2Qlv ciWzSs5g==; Received: from authenticated user by zero.zsh.org with local id 1mu5vW-000DCu-Q8; Mon, 06 Dec 2021 04:48:34 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f170.google.com) smtp.remote-ip=209.85.219.170; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-yb1-f170.google.com ([209.85.219.170]:33394) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mu5uf-000CUM-6R; Mon, 06 Dec 2021 04:47:42 +0000 Received: by mail-yb1-f170.google.com with SMTP id d10so28018041ybn.0 for ; Sun, 05 Dec 2021 20:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IqidX4CHY47+HkHI14MItoFMcgp1cXc14dpcvca8Kh4=; b=Mf4xca8sqnH1d5uBlprFnAqJgGs9DJ0l8gNF3FOEd1kLnJn1HVQdk21f9SDNkL9Lxu BBsm42Hsu81TAU5m/TctV9IX08MiqTldjgplL7xqIS8CWYxVgxgroBAzB3HCwDMUE6l2 UsmdldYD2gZ9iqhPORYblag3vqw0LVx31xugVPWCqfvWR0txhMd7U7ZhBtmJ3Lkztcg+ qb6enA4CN4qn0eR8oEHTPv5uNCif2fH2k+FNXpFnICUxV+d7u5w9HHYLfwrRNBzh8irq MSgbWUQWBgIZFtik6tsL8nKdQBVPzQopVRY7zoo4Gmsv7PS/NdBTcjAocQ63f0pdqWgQ oibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IqidX4CHY47+HkHI14MItoFMcgp1cXc14dpcvca8Kh4=; b=mq3KbeTdGU2wLt3PGlM7zaQVJxhxaoiLr+/G0Wn8f8zJ10+N6FLmjs6uO5Yf7GPrD/ IDti2ErzxCv5gQtbJh9r+qxMvWaQwDhhQVboS1YdWu7b4twJg4p01BKcZ8ECPCI4cEJm IM9mAxi0iZCR12J1pnTGvO5BAfAbLZgGuAakX+NYrE259AbI35rv38zVNZZ2q4fRxE5b BftGkSREOWan0f+DP5/cvF6M8UeqBIIA8uXShqNqB0RBr+ry8eFbN46zfXUTEeWfb5cB whItAvplrpJ2kTuSmcdKYGh4r2XoHA9IqDSw9nVn1qnbXM5XWZp0Ekw5DOpw0dq09zdG +tCg== X-Gm-Message-State: AOAM531YUE45UPUcfp01wUfufDNQrLMzrZBcoTsDxWxaPjTRrjRDokNR awBpAfceGggLNxtmcfGrW7xdLunwq32U4CIOeur7Mw== X-Google-Smtp-Source: ABdhPJwbVq1nmgnLiDTtmjGJLSnVI+Ia/FvKJeMixJ+0B5KX9EanvkmgdxC8LPmdlu6dnohTRetW0FQbZbdtFbLwT0U= X-Received: by 2002:a25:67c6:: with SMTP id b189mr41254713ybc.147.1638766059646; Sun, 05 Dec 2021 20:47:39 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sun, 5 Dec 2021 20:47:28 -0800 Message-ID: Subject: Re: Multipart autocomplete, zstyle, and cd To: Zach Riggle Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27418 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: On Sun, Dec 5, 2021 at 5:29 PM Zach Riggle wrote: > > _wanted -V popular-directories expl 'popular directories' \ > compadd -Q -a dirs > #-------------------------- COMPLETION ENHANCEMENT --------------------------- > This completion works well, though I would like to know how to get the > completion to not do word-separated completion and upon e.g. > > $ foobarbaz bi > > ... to not add a space, but instead allow further specification e.g., You should add the -f option to compadd, so that it knows the results are file names (which includes directories). I suspect you also do not really need/want the -Q option. You should also NOT include the trailing slash in the values returned from zshz-cd-completion. Either -f will cause compadd to figure that out, or you should be passing the options -S "/" and -q to compadd (if the strings returned by zshz-cd-completion might not refer to existing directories). > #-------------------------- CURRENT CD AUTOCOMPLETE -------------------------- > I would like to know how to get these results added to "cd" > autocompletion. > > zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories > > When I do "cd ", I get a single section, "-- local directory --". With that tag-order, you will only see path-directories if $cdpath is non-empty and there are no local directories. Is that what you wanted? (Directory-stack completes shorthands like "+1" so it normally doesn't matter where it appears in tag-order as long as it's there at all. [Someone please demonstrate how I've got this wrong, if I have.]) > #-------------------------- ADDING A SECTION TO CD --------------------------- > > Any pointers would be useful -- it's not clear if I need to define a > new tag somehow (via _tags?) or modify the _cd function and put my > modified copy earlier in $fpath. I hope / expect that this is > something that can be MOSTLY achieved via zstyle, but I'm not clear > how. There are a bunch of ways depending on the effect you want to get ... probably the easiest would be to use compdef to put a wrapper around _cd that also calls your function. Something like this: compdef '_alternative \ "popular-directories:popular directories:( $(zshz-cd-completion) )" \ ::_cd' \ cd Caveat, this will misbehave if zshz-cd-completion outputs strings containing double quotes or equal signs.