Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature Request: fc -C to clear history and reset counter
Markus Näher 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ä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 ?
>
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, «exec zsh» 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:
>
> history_edit() {
⋮
> }
>
> 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, UNUSED(int func))
*tptr++ = *aptr; /* No, keep original array element */
}
*tptr = NULL;
- s = sepjoin(tmparr, NULL, 0);
+ s = sepjoin(tmparr, "\n", 0);
} else {
s = ztrdup(getstrvalue(v));
}
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author