zsh-workers
 help / color / mirror / code / Atom feed
From: "Markus Näher" <markus.naeher@gmx.net>
To: zsh-workers@zsh.org
Subject: Re: Feature Request: fc -C to clear history and reset counter
Date: Tue, 19 May 2020 22:22:07 +0200	[thread overview]
Message-ID: <670c0cf4-cf73-22d8-1ac9-dfb392521b99@gmx.net> (raw)
In-Reply-To: <CAN=4vMpErMFeYaOt0bhuUefe-xgA+0gzRo-y7qXKXe7MS5GaSQ@mail.gmail.com>

On 19.05.20 20:28, Roman Perepelitsa wrote:
> On Tue, May 19, 2020 at 5:53 PM Markus Näher <markus.naeher@gmx.net> wrote:
>> but it's missing -C for clearing the history completely.
>
> Why not restart zsh with `exec zsh`?
>
> Roman.
>

And how do I load the project-specific history (and _only_ that one) in
the new instance ?

The new instance will execute all startup scripts (and that's OK because
of all other things like themes, settings, aliases, ...) and load the
"default" history.
So I still can not have the new history _without_ the "default" history
but counter starting at 1. This means I'm in the same situation again.


I have a second use case for clearing the history. I only started my
request with the use case that's easier to explain.

For bash, I wrote a function that allows me to edit the _whole_ history
(not only the last entry like fc), even reorder entries. This is it:

history_edit() {
  if [ "${EDITOR}" == "" ]
  then
    echo "EDITOR must be set."
    return 1
  fi

  tempdir="/tmp/${USER}"
  tempfile="/tmp/${USER}/bash_history.$$"

  if [ ! -d "${tempdir}" ]
  then
    mkdir -p "${tempdir}"
    chmod 770 "${tempdir}"
  fi

  history -w "${tempfile}"
  ${EDITOR} "${tempfile}"
  history -c
  history -r "${tempfile}"
  rm -f "${tempfile}"
}

I just cannot work without that. All of my working style is adapted to
having that option.

Markus

  reply	other threads:[~2020-05-19 20:23 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 [this message]
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
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=670c0cf4-cf73-22d8-1ac9-dfb392521b99@gmx.net \
    --to=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).