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

Re: history-beginning-local function



On Mon, Jul 14, 2008 at 10:42 AM, Peter Stephenson <pws@xxxxxxx> wrote:
> This function allows you to have a local history file [...]
>
> The main problem is that you have to create and update the local history
> file yourself since commands aren't saved to it.

One possibility would be to put something in chpwd that remembers the
history number upon entering a directory and, upon leaving it, appends
the higher-numbered history entries to the local file.

Another approach might be to have chpwd change the global HISTFILE.
Then use inc_append_history so that commands in each directory are
appended as you go.  That leaves just the problem of trapping shell
exit and writing the full history to the original HISTFILE (assuming
that's still desirable).



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