zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Markus Näher" <markus.naeher@gmx.net>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Feature Request: fc -C to clear history and reset counter
Date: Tue, 19 May 2020 15:33:37 -0700	[thread overview]
Message-ID: <CAH+w=7Zd+LBozmiecm1i0MFBWtnV0pZ_tPxgUY-5VyRiAu9vAA@mail.gmail.com> (raw)
In-Reply-To: <48e95c73-3a98-a4c2-7e0c-badf8544b4f2@gmx.net>

On Tue, May 19, 2020 at 8:53 AM Markus Näher <markus.naeher@gmx.net> 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.

  parent reply	other threads:[~2020-05-19 22:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 15:52 Markus Näher
2020-05-19 18:28 ` Roman Perepelitsa
2020-05-19 20:22   ` Markus Näher
2020-05-19 22:58     ` Bart Schaefer
2020-05-20  0:13       ` Markus Näher
2020-05-20  0:23       ` Markus Näher
2020-05-19 23:03     ` Daniel Shahaf
2020-05-19 23:17       ` Bart Schaefer
2020-05-21  3:37       ` Daniel Shahaf
2020-05-19 22:33 ` Bart Schaefer [this message]
2020-05-20  0:13   ` Markus Näher
2020-05-20  4:15     ` Bart Schaefer
2020-05-20  9:38       ` Markus Näher
2020-05-21  1:05         ` Bart Schaefer
2020-05-20 23:53       ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7Zd+LBozmiecm1i0MFBWtnV0pZ_tPxgUY-5VyRiAu9vAA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=markus.naeher@gmx.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).