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

Re: shared history but recalling history in current terminal



Am 27.11.2013 09:02, schrieb Bart Schaefer:
> On Nov 26, 10:31pm, Wayne Davison wrote:
>>
>> bindkey '^p' up-line-or-local-history
>>
>> up-line-or-local-history() {
>>     zle set-local-history 1
>>     zle up-line-or-history
>>     zle set-local-history 0
>> }
>> zle -N up-line-or-local-history
> 
> Another possibility is something like:
> 
> 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
> 
> Then incremental search is non-local history, everything else is local,
> and you don't have to re-create individual keybindings.
> 

Unfortunately, this seems only to work when not doing a 'RETURN' without
command in a session, because then the other sessions are imported again:

S1>ls
S2>echo muh
S1>(UP) -> ls (ESC)
S1>(RETURN)
S1>(RETURN)
S1>(UP) -> echo muh

This seems to be not completely deterministic, in some cases it does not
happen.

I tried to debug the widgets you defined, but any 'echo' or 'zle -M' I
put in there was ignored.

- René



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