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

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

I'm planning to switch to zsh. There's one thing missing that currently
keeps me from finally leaving bash behind:

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.
With bash, I usually do
  cd /path/to/my/project/; history -c; history -r project_bash_history
and I even set HISTFILE= to prevent writing to the history when I exit
the shell. Of course, I sometimes need to add desired commands to the
history file manually. That's what I mean by "curated history".

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. I've found
some hints to temporarily set HISTSIZE=0. Indeed, it empties the
history, but it does not reset the counter. So if the history had 137
entries, the new history will start at 138.

One advantage of my curated histories is that I know the numbers of my
most important entries. But they will get useless when they shift and
the amout is always different.

To me, a -C option in fc would be very helpful. Or maybe even -C -R to
clear and read in one call, but this would be bonus. :-)

Thanks and Regards,

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