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

Re: shared history but recalling history in current terminal



On Dec 9, 12:54pm, Jan Larres wrote:
} Subject: Re: shared history but recalling history in current terminal
}
} After some more investigation I noticed that unsetting local-history
} does actually work, but re-running the widget after entering something
} does not. So if I have this in my zshrc:
} 
}   bindkey '^r' history-incremental-pattern-search-backward
} 
} If I then press ^r and enter some word it gets correctly found in the
} global history, but if I press ^r again to search for an earlier
} occurence it always fails. Is there any way to fix this?

Since (as previously discussed) we don't have a hook for isearch-init,
the only way to fix that one is to rebind the widget:

    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

I haven't actually tested that but it should be close to something that
works ...



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