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

Local/global history with pattern isearch



Hi,

a few months ago there was a discussion about how to use the shared
history only for isearch, but not for example for the <Up> arrow search.
Since I use the history-incremental-pattern-search-backward widget
instead of the normal isearch widget the solution didn't work for me,
but Bart suggested this instead:

zle-line-init()  { NUMERIC=1 zle set-local-history }
zle -N zle-line-init
zle-isearch-update() { NUMERIC=0 zle set-local-history }
zle -N zle-isearch-update
zle-isearch-exit()  { NUMERIC=1 zle set-local-history }
zle -N zle-isearch-exit

history-incremental-pattern-search-backward() {
    if [[ $LASTWIDGET != history-incremental-pattern-search-backward ]]; then
        NUMERIC=0 zle set-local-history
    fi
    zle .history-incremental-pattern-search-backward "$@"
}
zle -N history-incremental-pattern-search-backward
bindkey '^r' history-incremental-pattern-search-backward

Unfortunately this still isn't quite working for me. It does use the
shared history when starting the search, but when pressing ^r again it
fails to find any other results, neither in the shared nor in the local
history. The custom function also doesn't get called again in that case,
I don't know if that's normal behaviour or not. I would be grateful if
anyone know how to fix this.

Cheers,
Jan



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