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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21252 invoked from network); 13 Jul 2021 12:01:01 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Jul 2021 12:01:01 -0000 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:Message-ID:Date: Content-Transfer-Encoding:Content-ID:Content-Type:MIME-Version:Subject:To: References:From:In-reply-to:cc:Reply-To:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=kRZyQfDN5AcAUnI3U7jlq1Qp+cFaldubWPquxJT9Vo8=; b=GkHibw/XPnLT94lx3Lj32J5eII 0r2fP/fJ6mA3grydhzU6M8+hhrgjbwd7ZhdFbooutXhDys7CUIf3kEuJsfd+whDdCZUzfNzAGXc1o 2FdVCguoghpcXl7LrKxrC74yryy13SMfEcX3rPnjkvh9hXmZyjzCZAlF41HrNcTOqVUkCzVlGS0eL m+tBzpTN+4QmYR+tMVU3Gd3u88E64oIw325aedw4K2crhTUMON4kIX30nUMLJJPgtcFWhF1lf1Yay qsRP3gIVNg8wejPSEUEolhlON3jA8GTm7L+/kW4QK/1om1kfZraUrcJxMomEY0VM7SCDiJTYy9Tf5 4UBWcFXw==; Received: from authenticated user by zero.zsh.org with local id 1m3H5w-000L6e-HX; Tue, 13 Jul 2021 12:01:00 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1m3H5E-000KMm-KE; Tue, 13 Jul 2021 12:00:16 +0000 Received: from [192.168.178.21] (helo=hydra) by mail.kiddle.eu with esmtp(Exim 4.94.2) (envelope-from ) id 1m3H5C-0009Es-5f; Tue, 13 Jul 2021 14:00:14 +0200 cc: Zsh Users In-reply-to: From: Oliver Kiddle References: To: =?UTF-8?B?UGV0ZXIgU2zDrcW+aWs=?= Subject: Re: Tweaking the completion engine to prefer some completions MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <35516.1626177614.1@hydra> Content-Transfer-Encoding: 8bit Date: Tue, 13 Jul 2021 14:00:14 +0200 Message-ID: <35517-1626177614.172306@tY6Q.TYg-.r6yl> X-Seq: 26786 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: Peter Slížik wrote: > > I have a few applications installed on my system, with their names sharing a > common prefix. > Now as the apps are company-specific, let me invent some contrived names: > > messageedit, messageview, messageformat, messagesend, you've got the idea. > > Now, in may daily work, I'm using only one of them: messageedit. The other are > used... well, almost never. > > Now, if I type mess, the name gets completed to message and the completion > engine waits for further input. > > I would like to tweak the completion in such a way the typing mess > completes the input to messageedit and ignores the other possible apps. > > Can this be done in a positive way (by naming the preferred application) or in > a negative fashion (by prohibiting all unwanted completions)? You can do this with the ignored-patterns style. On the surface, this works in the negative sense, e.g.: zstyle ':completion:*:commands' ignored-patterns messageview messageformat messagesend But you can use a pattern to turn this around into a positive form, e.g: zstyle ':completion:*:-command-:*:commands' ignored-patterns 'mess(^ageedit)' If you still occasionally want to complete the others, you may want to look into the _ignored completer to complete them as a fallback if you have entered a longer prefix. In the second example, I used a more specific context which will only apply in command position. You can vary that depending on the contexts in which you want it to apply. Oliver