From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3658 invoked by alias); 3 Dec 2014 03:54:13 -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: 19480 Received: (qmail 26098 invoked from network); 3 Dec 2014 03:54:02 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) 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 autolearn=ham version=3.3.2 X-Authority-Analysis: v=2.1 cv=AduIQRnG c=1 sm=1 tr=0 a=wF+YgKUkZNOBI+JmS0mQZQ==:117 a=wF+YgKUkZNOBI+JmS0mQZQ==:17 a=G8GL833Es-AA:10 a=N659UExz7-8A:10 a=wGh8EkKqM_BDoXkpWHEA:9 a=pILNOxqGKmIA:10 Message-id: <547E8955.1030906@eastlink.ca> Date: Tue, 02 Dec 2014 19:53:57 -0800 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.2.0 MIME-version: 1.0 To: zsh-users@zsh.org Subject: Re: trivial problem with histverify References: <547CCD76.2020806@eastlink.ca> <547D0369.3060802@eastlink.ca> <141201184701.ZM30368@torch.brasslantern.com> In-reply-to: <141201184701.ZM30368@torch.brasslantern.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 12/01/2014 06:47 PM, Bart Schaefer wrote: > It is not intended to verify that "a history command is actually being > executed." It is intended to verify that in the text of any command in > which history was referenced, the correct history reference was made. > > For example, suppose you typed ... I see. I had the wrong notion. (What a surprise ;-) > Honestly, how did it ever get that complicated? Why print -s the words > into the history and then pull them back out again with "!!" rather > than just: > > bindkey -s '\e[5~' '\C-a history 1 | grep "[[:digit:]] \C-e"\C-m' I don't know how it got like that. It seemed necessary at the time, but yours works just as well, and makes more sense too. At the time I just wanted it to work and I haven't thought about it since. Looking back, I may have built it up from this: # Ctrl+H: put existing command line into history w.o. executing it first. bindkey -s "^H" '\C-a print -s \C-e\C-m' ... which seems to need the 'print -s' action, so I got it into my head that that was the only way to get a line into history without ENTER. Oh, and of course it no longer trips over 'histverify' :-) grep-history() { (( HISTNO > 1 )) || return zle -I history 1 | grep --color=auto "[[:digit:]] $BUFFER" } zle -N grep-history bindkey '\e[5~' grep-history I haven't done a widget yet, this looks like a good place to start. Thanks again sir.