Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: make history-complete-older do nothing on empty string
- X-seq: zsh-users 23349
- From: Vincent Bernat <bernat@xxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: make history-complete-older do nothing on empty string
- Date: Wed, 18 Apr 2018 18:28:02 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- 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=
- In-reply-to: <CAH+w=7ZJd8Ruf7-Pwozjyt=zcQKE3ND5w=vE=QuSPfHyo2nwYA@mail.gmail.com> (Bart Schaefer's message of "Wed, 18 Apr 2018 09:11:11 -0700")
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20180418052832epcas2p1df623a44c88edae226f65a2d5edc90f2@epcas2p1.samsung.com> <m3tvs9um1s.fsf@luffy.cx> <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> <CAH+w=7ZJd8Ruf7-Pwozjyt=zcQKE3ND5w=vE=QuSPfHyo2nwYA@mail.gmail.com>
❦ 18 avril 2018 09:11 -0700, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> :
> 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:- } == ' ' && ${RBUFFER:- } == ' ' ]] && 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]} == ' ' || ${LBUFFER} == '' ]] && return 1
zle _history-complete-older "$@"
}
zle -N vbe-history-complete-older
bindkey "^[/" vbe-history-complete-older
#v-
--
Harp not on that string.
-- William Shakespeare, "Henry VI"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author