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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27230 invoked from network); 6 Dec 2021 01:30:18 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Dec 2021 01:30:18 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1638754218; b=kmlJeUU1NuXLehPYSc01wVT+TwZlDKkF31soRIvm1E0uWR/zNkqdMOK88TR8gVOpJLtXYxj25e wwWXcXN11iy2TarDmnRael4EJxxp0bjMwDz8x/78bowLh2TwDSkIlcRoVRsG2/6ZF3wSzAjuC3 kj+JjwNkEFBEEMDD0+GuaCC9qsTAV0ohAhUmHNiovSPWZUKeEThvEmYdPk9UpoweZM02b53i/C EBIxR2wFLIihntNbgVp1sfBcchkVki8pC+Kn1V4TkOF+AhkWDHfNBfs2Ae8HN5pahmcxd9h3AH /AX1jDQZeaAKqjke/62aTtjxrySEgX+A4jlhVDZrUkY5uA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wm1-f41.google.com) smtp.remote-ip=209.85.128.41; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1638754218; bh=xPDQF2H2eGyfjQIUbn1cY+GjMpiuabfDaR38lOPa1Z0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=UwlBcBGSHiCzaU4cwi9ozBsOV1luGum+Vnw9jXsBMhP1oaISLQVtq9AnRprV/CJthHYez5bEyr bzUi29/8qX2ZPJHZw+x/IkUWbbUntNfEZ+8vKbtSZtJY6Qp9obJLWSjsiPCGdrOjGkN+U64uTc ldjbh14IJwRbseGZR7o/Ja5seGs3qP6cjU5Ni0RQbnIffXkvr4ccyKZQsB4q7dhuwCg/kPSRLn q2p0I2VfOnU9+2c+nDq9zwuBtFZkMdtRQLjHzhGA0jNrHMROsOqOYjP0s/iy5xeAeAYg+1XZig uf7URaIQvdcLyuGJqNB6ZNNIdjj2GTOP2SVyZAckUZyvqQ==; 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:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=makVA1ciAFM+y6lUbGM+ZWyg9OhItGrCYwEWo3AMk+s=; b=rN7cjugjbjaEqlzeAFY0C/cJFb V4zY8rGuN5NbPa2I8XHopIdQEkCGlQJBWiuBTFmJCz236AexqAYMTIocIb2+fPHeNzsYfhjFgGFRI M65vd4tTfBwm3SrScMQmpzc9VoKbGyfSYwAlMeNQOiW4zGGoi3YyfsH2Jbixn5pbU8cDsQYi/ukQ1 mnBlT45nwIiXBgRDQmMZexitvMAsege1opu9rGZTQYpBPjb5eDG7JOatH9uSZDwv/5hm6iiL3o2o6 6Rl1gpftOE3V4RkmBc44Q3lnVsDa7bLUPgDYhWPR0a4WTnDlJBj/5yTM1JavSVVTDep1/Qnd7aYks MYysPLbg==; Received: from authenticated user by zero.zsh.org with local id 1mu2pd-00077c-EL; Mon, 06 Dec 2021 01:30:17 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wm1-f41.google.com) smtp.remote-ip=209.85.128.41; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wm1-f41.google.com ([209.85.128.41]:52154) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mu2oX-0006KL-B0; Mon, 06 Dec 2021 01:29:10 +0000 Received: by mail-wm1-f41.google.com with SMTP id 137so6960193wma.1 for ; Sun, 05 Dec 2021 17:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=makVA1ciAFM+y6lUbGM+ZWyg9OhItGrCYwEWo3AMk+s=; b=O96vwZVfVumgCbz0t+US6go8NNbL+8QzWzuS34o+L3jjkGtJkeHVn17XWRNcEc3h0w GjlEbZF6by/effaUF8W52LBlKyCKsVTEmu0XTU4TMwfCX4Bbg2OZyhsV5p4EHz2uL44f 1giRqgnI4KUVAfFYPSnRwjqEIBaYubtSDg37H45HuiOPqxLTgjBlrX6pqq1KtYF46PsW mq7Qj6jG2ux6yyWflz4cDufmYFG7vawOlf5gJL0mQdMjQasgXO+1Lj6szC0uMiLdoKdi CxL5elMHMAIcbw+b3gi/mPrf7/RCgA+m90hVHS2ITOu0qWRi0SeCdwBfWI1WbzNvMy2C AoSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=makVA1ciAFM+y6lUbGM+ZWyg9OhItGrCYwEWo3AMk+s=; b=Hyy8fSIXstDJLslTD2TNDbBJ+WIWYJ8ECUHKJzE4hbX9gf+4/X8UkuM4dskS+1p/nf D9FgAa9rZKa5WOZPYCzTbq2HsIXta9DIARl4IGOAXggeV3LkgvOljIqNLb3Y7B8A29gs hS/Pp79n5YCR7I9m0SD0BAJ4vVFDgN64XDEtmrDHQ9e30l0Gh/ZUdZmk73d+03QP+/ts BJom6wnxSA2VNGDoB+FnEoxTTWQpz6Zuc2IFyA0hH5wgV/OIWJ1RvXnARsb2/+iJB92r qg4D4yhegLJ3rBuQK3gE/bMIaoLdxF8qeNFgHmB2sjVSi+gdNpTzs4h06zrVwa+P816L qHpA== X-Gm-Message-State: AOAM531L7BHpa0clYdKUtpCg1dZASe+cxTdnifNDiEcRhd8ugbZXH/Tu pFoqeAzoUXtkp02c9ArrImVLxpd7qV5YmYjbLCtz8GNQAKZ+9g== X-Google-Smtp-Source: ABdhPJyOJZNX3RDbqFBV5a9D22HTc3hVWh2u/0YCdIDToLwsmsUq45EmFCwVZRjaDBshO+5SzrmP4vQSVfn4IUFCwII= X-Received: by 2002:a7b:c256:: with SMTP id b22mr34947553wmj.176.1638754148538; Sun, 05 Dec 2021 17:29:08 -0800 (PST) MIME-Version: 1.0 From: Zach Riggle Date: Sun, 5 Dec 2021 19:28:57 -0600 Message-ID: Subject: Multipart autocomplete, zstyle, and cd To: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27417 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: I would like to add a new autocomplete section to the tab-completion of "cd". I have some of the pieces of this working, but haven't figured out how to hook it up correctly. #-------------------------------- BACKGROUND --------------------------------- I have a zsh autoloadable function, zshz-cd-completion. Its implementation is not relevant, except that it outputs a list of directory names in a specific order. For now, let's assume zsh-cd-completion emits the following lines: Downloads/ bin/ Library/ Desktop/ #-------------------------------- COMPLETION --------------------------------- I have completion working for a placeholder command, foobarbaz. This is done with a file, _foobarbaz, also in $fpath. It is very straightforward, and works as intended. #compdef foobarbaz _arguments \ '*: :->custom' case "$state" in custom) local -a dirs=( $(zshz-cd-completion) ) # Old: Does not preserve ordering # _values "popular directories" $dirs _wanted -V popular-directories expl 'popular directories' \ compadd -Q -a dirs ;; esac #-------------------------- 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 Turns into... $ foobarbaz bin/ ... to not add a space, but instead allow further specification e.g., $ foobarbaz bin/subdir #-------------------------- CURRENT CD AUTOCOMPLETE -------------------------- I would like to know how to get these results added to "cd" autocompletion. I expect that I can do this from zstyle. Currently, this is how things are configured: $ zstyle -L | grep :cd: zstyle ':completion:*:*:cd:*:directory-stack' menu yes select zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories When I do "cd ", I get a single section, "-- local directory --". #-------------------------- ADDING A SECTION TO CD --------------------------- I tried my very best to comprehend Section 20 "Completion System" of the documentation, and various other distillations on Github and so on -- but this is the most complex documentation I've come across, and the various "magic" that powers it is too complex to read through. 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. Zach Riggle