From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 766 invoked by alias); 18 Apr 2018 16:28:20 -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: List-Unsubscribe: X-Seq: 23349 Received: (qmail 8997 invoked by uid 1010); 18 Apr 2018 16:28:20 -0000 X-Qmail-Scanner-Diagnostics: from bart.luffy.cx 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(78.47.78.131):SA:0(-1.9/5.0):. Processed in 14.822971 secs); 18 Apr 2018 16:28:20 -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.9 required=5.0 tests=BAYES_00,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: bernat@luffy.cx X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=luffy.cx; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=postfix; bh=qgg0E7S0DqkxDR7N3KRBJpFxZXM=; b=AFK 88MN6Z8oWLf9yIjcvIukJB/DOXacJ4z8ArNS9EgF932ZP8qCcx8nDNcpf0RfkT8r F2H6SRMYmLGaqhXaXWyLxGM/4w11KWhkjBLBAwaWdI9Vfe/vVVKHELxg2dmTZEQ4 GaVmHOUQ8vy9vJ5X/Yormm/XIHGPKfR0lDAgwizI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=luffy.cx; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=postfix; b=Fmkv7mf49R789bkEjfTkpimehnogi 0+L6qk3uJSurAFHwbtX1LjFSDHZ+ZgLiUN7T0QbAFx3T/juWQc5ZdCcbtB0JllAx PnclrMbzfZQoKWSDL7uxSkUhEkALP9QjRiG0RtDFLjK7CGsTr/lleLjB1eGZ17yo gVadgb2VB4TS44= From: Vincent Bernat To: Bart Schaefer Cc: Zsh Users Subject: Re: make history-complete-older do nothing on empty string References: <20180418094018.54559594@camnpupstephen.cam.scsc.local> <87in8o6fjx.fsf@luffy.cx> <20180418104555.25fef55b@camnpupstephen.cam.scsc.local> <874lk866zp.fsf@luffy.cx> <20180418135817.7edca58c@camnpupstephen.cam.scsc.local> Date: Wed, 18 Apr 2018 18:28:02 +0200 In-Reply-To: (Bart Schaefer's message of "Wed, 18 Apr 2018 09:11:11 -0700") Message-ID: <878t9k4gz1.fsf@luffy.cx> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =E2=9D=A6 18 avril 2018 09:11 -0700, Bart Schaefer =C2=A0: > You'd want a wrapper around _history_complete_word to check the state > of the editor buffer, or you could copy that function to a location at > the front of your $fpath and modify it. The test you want is probably > something like: > > [[ ${LBUFFER:- } =3D=3D ' ' && ${RBUFFER:- } =3D=3D ' ' ]] && return 1 > > There's a space after :- in both of those references. This means "if > either the buffer is empty or the cursor is sitting in the middle of a > run of spaces, then return" (i.e. don't complete anything). Thanks, I am using this and it works as I would expect: #v+ # Don't do history completion on empty words function vbe-history-complete-older() { [[ ${LBUFFER[-1]} =3D=3D ' ' || ${LBUFFER} =3D=3D '' ]] && return 1 zle _history-complete-older "$@" } zle -N vbe-history-complete-older bindkey "^[/" vbe-history-complete-older #v- --=20 Harp not on that string. -- William Shakespeare, "Henry VI"