From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: "Markus Näher" <markus.naeher@gmx.net>
Cc: zsh-workers@zsh.org
Subject: Re: Feature Request: fc -C to clear history and reset counter
Date: Tue, 19 May 2020 23:03:41 +0000 [thread overview]
Message-ID: <20200519230341.61e4d2a3@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <670c0cf4-cf73-22d8-1ac9-dfb392521b99@gmx.net>
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@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 ?
>
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
next prev parent reply other threads:[~2020-05-19 23:04 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
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 [this message]
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=20200519230341.61e4d2a3@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=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).