From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6259 invoked by alias); 18 Aug 2017 01:07:25 -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: 22837 Received: (qmail 2281 invoked by uid 1010); 18 Aug 2017 01:07:25 -0000 X-Qmail-Scanner-Diagnostics: from out1-smtp.messagingengine.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(66.111.4.25):SA:0(-2.6/5.0):. Processed in 2.245431 secs); 18 Aug 2017 01:07:25 -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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=8nKBIS yIC+bt8MTwrhp/wFhKBLOTaVDGo/V1uiJlVtQ=; b=EkAVPF6Z7R84pQP6OdWz7/ IOhJjIf/nxV7SkqsggINGU10QFx84clNH3p/3XaX1PWGfQoOyFUQu48/UOcKB7j8 rbZTQZ+rkv9XRgtdPk+uUJI6xy0pLxPeSpm/hUmJoBZnkadJS8VMB3CySDl2MciB /z2hbPNVqQiFtSQIR4hEezMyPwvj4S2Y7nIiuR0Zi8SVKW1KnWJea7O5b9uvxEVf eYjHUVrZ0idkKuGtPoIZeaIDOmpN9EaUve94EmlQmd1rYMQWfdRnaa1ZcM0QmuSS GtUGsadsPQy0CTHovPmVB/QbbjHeh9fFRM1fnhy9VX0Go3KWXgpd65I26n4tUbvg == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=8nKBIS yIC+bt8MTwrhp/wFhKBLOTaVDGo/V1uiJlVtQ=; b=dTMOoKCDAKs6xUzp1ieUgo FmMWdo/IqlyZlQ4yI38ArZSpXuX4D5ngBdwAYNt3gjRZR65dC4HTxBJMK5hRjJg1 ldAjGUbO2ph00qH1Hvo/WQGkRsM2dh4yePtcpbG+bTRt/1X64Hzp5XiOHN6Mq5NF 9RMVSUVfHm3f4g6A3+bLoajp1jdX4LHPecap9zjZFQf/p93UluTkXhYl3lSfGKFK lof8Ikq7an/XE+SyAvTVEhFs4qkFYcY6G/tnhDdU119EYYCCuPiVqxsfDAuKrLyc s4ajqRSOL2z5JAJ8UiNFao26gSHySry+sxGymXUsXANP/ehW131Am6ZjZP2AGXYQ == X-ME-Sender: Message-Id: <1503018440.3774801.1077066976.3967894E@webmail.messagingengine.com> From: Daniel Shahaf To: Grant Taylor Cc: Zsh Users List MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-21c69044 Subject: Re: Conditionally complete on space. Date: Fri, 18 Aug 2017 01:07:20 +0000 In-Reply-To: References: Grant Taylor wrote on Thu, 17 Aug 2017 16:34 -0600: > Thus I want to conditionally complete if there is not a space proceeding > the cursor's current position. If there is a space proceeding the > cursor, then put a space and not call expand-or-complete. Define a custom widget: maybe-complete-on-space() { if [[ $LBUFFER[-1] == ' ' ]]; then zle self-insert else zle expand-or-complete fi } zle -N maybe-complete-on-space and bind it: bindkey ' ' maybe-complete-on-space This implements the behaviour you specified, but I suspect you meant the 'if' and the 'else' behaviours to be the other way around. > I am guessing that I will need to modify expand-or-complete's behavior > via modifying _main_complete, or wrap _main_complete with something else > to do the conditional logic and then call _main_complete, and update zle > so that expand-or-complete calls the wrapper instead of _main_complete. You aren't changing the behaviour of completion, you are just changing the method of invoking it, so the solution was in zshzle(1)'s domain, not in zshcompsys(1)'s. Cheers, Daniel