Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: trivial problem with histverify

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.

Messages sorted by: Reverse Date, Date, Thread, Author