From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8152 invoked by alias); 12 Sep 2017 07:33:35 -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: 22897 Received: (qmail 7186 invoked by uid 1010); 12 Sep 2017 07:33:35 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f41.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.214.41):SA:0(-1.4/5.0):. Processed in 1.820853 secs); 12 Sep 2017 07:33:35 -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=-1.4 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_SPAM, SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qoOvLZhuMG9ITAUBz7kNN9F0TnmM7h27aK+vs1b/zpE=; b=x/cCExiDjwMwCUHbjBhlhu2h9+jR6q4xrruKDgIefV4Cmuz495vBoX9L84CVweqfoO ffEB06dTcAbo95wcrYSvOLVJE6E6yunW++PfeE2NQPw8DxfrQJ0mnDrNSFuFZAOj+d96 +kfasT/pXLzUxp/qIt8twdqmYbRwBbtbmTbkAY9ml0r2Bga06HVTQPX8f6+Vw/0Qh1Bf TvUEYdh4DIg4g8oEW1w0Qhz0iAg7WPcYSpUL8+JEvFuUhIaugWnQYPlfL5ry5L30ixt7 hVyweDsOP1+uuCybmk+eQTwabbHlQM1XRjW7oYahzEMNkTAmA3bhCO0L99YgGOijpEWB AyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qoOvLZhuMG9ITAUBz7kNN9F0TnmM7h27aK+vs1b/zpE=; b=K8DBrYbEAy9RNV+3WyqiEpWoAimLY+YpFRbc8Zd84xqkc6KTBiyvqMTZW3IhBCnBJ0 748lA9jsSNWHoFyxI+dsZzi3FzBgOdmpJfoaQBVMGdoHF78/HHUYpqRG6/t6M91knc9z 0IQYTK450u6aJnhuNc/3tDA7QXFURC0OZ3S+WVegXwvzsUeDSqe15Fruiq4419ylBASd o+/B1XrCzZJ0OhwLLt/R+7bTBv2vZebzuajGAua/Cg5DQj4PdfCftcPuTJi9qH7EYpWE awQXAKAhCJ3gtpPpSwZK3VEWeDsfaKBCkjljUiGtyfZacqvSIsrzEzVXwyjC8qRD2VWc J+Ww== X-Gm-Message-State: AHPjjUi6WGnfcY7D2BVH9C7i/N/sDXNonWs3vdYx2gcPTEBFc+69qXTP XemrA1uXUiD1xDphEcy6Ug8XPHKHKmUDvTF8Qw== X-Google-Smtp-Source: AOwi7QAxeMEy4hYcK4VOaUDNtEQzr5InDzKw7/sgywspyaX+jRZJ81kka4Suq/6FgxnsoG28BI5qt2cSCoH3CF0cKAk= X-Received: by 10.36.185.70 with SMTP id k6mr17282672iti.102.1505201611146; Tue, 12 Sep 2017 00:33:31 -0700 (PDT) MIME-Version: 1.0 X-Originating-IP: [173.20.63.226] In-Reply-To: References: From: dana Date: Tue, 12 Sep 2017 02:32:50 -0500 Message-ID: Subject: Re: Complete certain external commands separately by path? To: zsh-users@zsh.org Cc: dana geier Content-Type: multipart/alternative; boundary="94eb2c0ad18a5928670558f90f88" --94eb2c0ad18a5928670558f90f88 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Actually, i think someone on IRC has pointed me in the right direction. Here's my take on their suggestion, applied to my example above: # Put a `commands-bin2` tag ahead of the regular `commands` one zstyle ':completion:*:-command-:*' tag-order 'commands:-bin2:favoured\ external\ command commands *' # Have `commands-bin2` ignore any command whose hashed path does NOT match `/bin2/*` zstyle ':completion:*:-command-:*:commands-bin2' ignored-patterns "^(${(kj<|>)commands[(R)/bin2/*]})" # Optionally, have `commands` ignore any command whose hashed path DOES match `/bin2/*` # (otherwise they'll appear in both groups =E2=80=94 matter of preference) zstyle ':completion:*:-command-:*:commands' ignored-patterns "(${(kj<|>)commands[(R)/bin2/*]})" If you can think of anything wrong with this method please let me know. Otherwise it seems to work so far! dana On 11 September 2017 at 21:08, dana wrote: > Hey again, > > I have a problem that i hope can be solved with `zstyle` somehow: I want > to make it so that when i complete external commands, zsh gives me the > possibilities from one particular directory ahead of (and ideally separat= e > from) all the others. Seems like the most reasonable way to do that might > be to create some kind of sub-group that i can put up top with `zstyle > ... group-order` or whatever? > > Here's a contrived illustration of what i mean: > > Given a PATH like this: > > % print $PATH > /bin1:/bin2 > > And executables spread across that PATH like this: > > % ls /bin1 /bin2 > /bin1: > foo1 foo2 > > /bin2: > foo3 foo4 > > My current completion behaviour looks like this: > > % foo > completing external command: > foo1 foo2 foo3 foo4 > > What i *want* is to pull the /bin2 possibilities out into their own group > so i can have them completed first =E2=80=94 so i'd have something like t= his: > > % foo > completing favoured external command: > foo3 foo4 > completing external command: > foo1 foo2 > > Is there an easy way to do this? > > Cheers! > dana > > --94eb2c0ad18a5928670558f90f88--