Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature Request: fc -C to clear history and reset counter
- X-seq: zsh-workers 45850
- From: Markus Näher <markus.naeher@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Feature Request: fc -C to clear history and reset counter
- Date: Tue, 19 May 2020 22:22:07 +0200
- Autocrypt: addr=markus.naeher@xxxxxxx; keydata= mDMEXi1PPhYJKwYBBAHaRw8BAQdA5mC+PjCn5mz47ngBjY5+8r9YeloIjigNtKiHPaSlvAW0 JE1hcmt1cyBO5GhlciA8bWFya3VzLm5hZWhlckBnbXgubmV0PoiWBBMWCAA+FiEEVnCH2Hg5 cG3BryclHHm+zifSIesFAl4tTz4CGwMFCQlmAYAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA CgkQHHm+zifSIeuzrQEA1dCwtJCeDcc20kPViqt5ekqidR3gpW59obGT+xvt5pgBAMyawHqH pa+PH4Mr6+9Sh/6u/yI01WwvGAK/m2CJT6sOuDgEXi1PPhIKKwYBBAGXVQEFAQEHQO2mlMor hTTZq9WUdRZMc2NhGaapZ9ZyaQesF23tQGU7AwEIB4h+BBgWCAAmFiEEVnCH2Hg5cG3Brycl HHm+zifSIesFAl4tTz4CGwwFCQlmAYAACgkQHHm+zifSIes1TQEAs2SYqsBfB++PKJIFcZdh 2xkH5YBaSN5L8hepGnb8mhgBAKZqF4jEppwZt0/c92ymZu2EssLB2WIOx+V6LazlYMkF
- In-reply-to: <CAN=4vMpErMFeYaOt0bhuUefe-xgA+0gzRo-y7qXKXe7MS5GaSQ@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <48e95c73-3a98-a4c2-7e0c-badf8544b4f2@gmx.net> <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@xxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author