From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 744 invoked from network); 19 May 2020 20:23:07 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 19 May 2020 20:23:07 -0000 Received: (qmail 16878 invoked by alias); 19 May 2020 20:22:54 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45850 Received: (qmail 13605 invoked by uid 1010); 19 May 2020 20:22:54 -0000 X-Qmail-Scanner-Diagnostics: from mout.gmx.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.3/25814. spamassassin: 3.4.4. Clear:RC:0(212.227.17.22):SA:0(-2.7/5.0):. Processed in 2.261014 secs); 19 May 2020 20:22:54 -0000 X-Envelope-From: markus.naeher@gmx.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at gmx.net designates 212.227.17.22 as permitted sender) X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Subject: Re: Feature Request: fc -C to clear history and reset counter To: zsh-workers@zsh.org References: <48e95c73-3a98-a4c2-7e0c-badf8544b4f2@gmx.net> From: =?UTF-8?Q?Markus_N=c3=a4her?= Autocrypt: addr=markus.naeher@gmx.net; 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 Message-ID: <670c0cf4-cf73-22d8-1ac9-dfb392521b99@gmx.net> Date: Tue, 19 May 2020 22:22:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US-large Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:sASco1+ouplp7/ltznPe6rEIEYt5hDR3h6ZNcylTq1ayGvkVl1J 12Cr693E/2zzdw++TfJoy8/iQEUcTug7EUmfWX5RDmoepXC28UIVx09cC3aOr6Lp4CdJqLx tlnT9QIFiL2flew175rxSryh7mbiZiDeCort0fFGJWZ9fV5K9HbIfDXER7XbdDmGI5qC3fa HCXga+vohf5IWagDsDdIA== X-UI-Out-Filterresults: notjunk:1;V03:K0:cF7VSWG8usE=:E+C9KUWKkYW8X2DynjmX8n HspoXGMRzH28m7XGIYjBAddfEENmlVRbPwWVCtz3IkZdbGBnSfeOo46YIb/XTL7aaE7AA23BL Wp6G+MED6RgAQC/605502M6zC0mQjB9ip53cDrPcoVyvIH7Jpc+JmJW7SjNdwUISHuIYLunqW RZ0bd8bq9FyO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xCqZ2MnptZHTukCPrKy 2GGaOx1nSw2NQJLrM On 19.05.20 20:28, Roman Perepelitsa wrote: > On Tue, May 19, 2020 at 5:53 PM Markus N=C3=A4her 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}" =3D=3D "" ] then echo "EDITOR must be set." return 1 fi tempdir=3D"/tmp/${USER}" tempfile=3D"/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