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=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17277 invoked from network); 19 May 2020 23:04:35 -0000 Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 19 May 2020 23:04:35 -0000 Received: (qmail 5048 invoked by alias); 19 May 2020 23:04:27 -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: 45854 Received: (qmail 270 invoked by uid 1010); 19 May 2020 23:04:27 -0000 X-Qmail-Scanner-Diagnostics: from out5-smtp.messagingengine.com 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(66.111.4.29):SA:0(-2.6/5.0):. Processed in 4.916537 secs); 19 May 2020 23:04:27 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddtkedgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkjghfofggtgfgsehtqh dttdertdejnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpefhtdetfeehveeutd ehuddtieefgeettedtjedtffehudeiieejleetteekudetheenucfkphepjeelrddujeej rddufeegrdefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Date: Tue, 19 May 2020 23:03:41 +0000 From: Daniel Shahaf To: Markus =?UTF-8?B?TsOkaGVy?= Cc: zsh-workers@zsh.org Subject: Re: Feature Request: fc -C to clear history and reset counter Message-ID: <20200519230341.61e4d2a3@tarpaulin.shahaf.local2> In-Reply-To: <670c0cf4-cf73-22d8-1ac9-dfb392521b99@gmx.net> References: <48e95c73-3a98-a4c2-7e0c-badf8544b4f2@gmx.net> <670c0cf4-cf73-22d8-1ac9-dfb392521b99@gmx.net> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Markus N=C3=A4her wrote on Tue, 19 May 2020 22:22 +0200: > On 19.05.20 20:28, Roman Perepelitsa wrote: > > On Tue, May 19, 2020 at 5:53 PM Markus N=C3=A4her wrote: =20 > >> but it's missing -C for clearing the history completely. =20 > > > > Why not restart zsh with `exec zsh`? > > > > Roman. > > =20 >=20 > And how do I load the project-specific history (and _only_ that one) in > the new instance ? >=20 There are plugins out there that provide per-directory history for zsh. Have you seen them? > 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. Yes, =C2=ABexec zsh=C2=BB is a bit of a sledgehammer. > 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: >=20 > history_edit() { =E2=8B=AE > } =20 >=20 > I just cannot work without that. All of my working style is adapted to > having that option. I thought we might be able to present the history as a magic variable (like $aliases). With this, you'd be able to reset the history (by assigning to the variable), edit the history (with vared + edit-command-line), etc.. This would also sidestep some of the serialization issues Bart describes in his reply. Also, we should probably make vared emit array elements one per line, shouldn't we? That seems to be just: diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 8c0534708..53ecaed63 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -1767,7 +1767,7 @@ bin_vared(char *name, char **args, Options ops, UNUSE= D(int func)) *tptr++ =3D *aptr; /* No, keep original array element */ } *tptr =3D NULL; - s =3D sepjoin(tmparr, NULL, 0); + s =3D sepjoin(tmparr, "\n", 0); } else { s =3D ztrdup(getstrvalue(v)); } Cheers, Daniel