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

Re: Feature Request: fc -C to clear history and reset counter



On Tue, May 19, 2020 at 8:53 AM Markus Näher <markus.naeher@xxxxxxx> wrote:
>
> I'm using multiple individually curated histories for my projects. This
> keeps the history short and clear. One history (my "default" history) is
> for my non-project-related day-to-day tasks.
>
> I've learned that the corresponding zsh command is "fc". It has -R (and
> -W), but it's missing -C for clearing the history completely.

Zsh has what I think is potentially a superior mechanism:  fc -p / fc
-P to push and pop the history, respectively.

fc -p creates a new empty history, resetting the counter
fc -P discards the pushed history (if any) and restores the previous one

So you can simulate bash's "history -c" by "fc -P;fc -p", with some
appropriate extra arguments to manipulate history sizes and file
locations.

It should even work to do "fc -p" in your .zshrc file so that the
"default" history is always empty and
The initial read of the history file goes into a pushed history.



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