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

Re: shared history but recalling history in current terminal



On Nov 27,  8:08pm, René 'Necoro' Neumann wrote:
> Subject: Re: shared history but recalling history in current terminal
>
> Am 27.11.2013 09:02, schrieb Bart Schaefer:
> > 
> > zle-line-init() { zle set-local-history 1 }
> > zle -N zle-line-init
> > 
> > zle-keymap-select() {
> >     [[ $KEYMAP = isearch ]]
> >     zle set-local-history $?
> > }
> > zle -N zle-keymap-select
> 
> Unfortunately, this seems only to work when not doing a 'RETURN' without
> command in a session

Hmm.  The behavior you are describing would seem to imply either that
you've omitted the "1" argument to set-local-history, or that it is
being ignored and set-local-history is simply toggling the state each
time it is called.

And indeed GDB confirms that passing the argument does not have the
expected effect.

Workaround is:

    zle-line-init() { NUMERIC=1 zle set-local-history }
    zle-keymap-select() {
      [[ $KEYMAP = isearch ]]
      NUMERIC=$? zle set-local-history
    }

The documentation says "set it with the numeric argument" so I'm not sure
if this is just Wayne's misunderstanding or if zle_hist.c needs a patch.



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