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

Re: shared history but recalling history in current terminal



On Tue, Nov 26, 2013 at 12:30 PM, shawn wilson <ag4ve.us@xxxxxxxxx> wrote:

> what I'd like is to be able to search a shared history but have my up
> arrow use just the history in my current terminal. Is that possible?
>

Yes, that's possible.  I do something similar, where I have Ctrl-P/Ctrl-N
only go through local history (I leave up/down arrow going through the
shared history).


bindkey '^p' up-line-or-local-history
bindkey '^n' down-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
down-line-or-local-history() {
    zle set-local-history 1
    zle down-line-or-history
    zle set-local-history 0
}
zle -N down-line-or-local-history

If you change that to bindkey the arrows, you'll get what you want.

..wayne..


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