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

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



On 20.05.20 00:33, Bart Schaefer wrote:
> 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.

I would not call any of these concepts superior to the other. Different
people just prefer different things.

I've read about the push/pop feature, but I'm more the "throw away the
old stuff and start over" kind of guy. I'll never need to pop. :-)

Can you give me some advice about the "appropriate extra arguments" you
wrote about ? My goal is to really start over, having nothing left from
the previous history.



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