From: Pier Paolo Grassi <pierpaolog@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: widget accept-no-history
Date: Thu, 24 Aug 2023 16:01:14 +0200 [thread overview]
Message-ID: <CAP+y1xAPkaACMYJr93qibBKSmPYW2D3MYShWwA9xdKz=ejd7NQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7ZrFOsQv+HTAzMxW+XeyRdJ-EsbuD3MzBSEeGawrpP8Hw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 802 bytes --]
I see, I wasn't aware of the zshaddhistory hook
thanks Bart
Pier Paolo Grassi
Il giorno gio 24 ago 2023 alle ore 05:20 Bart Schaefer <
schaefer@brasslantern.com> ha scritto:
> On Wed, Aug 23, 2023 at 7:41 AM Pier Paolo Grassi <pierpaolog@gmail.com>
> wrote:
> >
> > Years ago I created a widget that allows me to accept a line without
> committing it to the history:
> [...]
> > So I wonder, what would be a better implementation?
>
> How about something along the lines of:
>
> execute_no_history() {
> setopt hist_ignore_space
> zle .accept-line
> }
> zshaddhistory() {
> [[ -o hist_ignore_space ]] && return 2
> }
> precmd() {
> unsetopt hist_ignore_space
> }
>
> You can use a global variable instead of any otherwise-unused setopt
> if you prefer.
>
[-- Attachment #2: Type: text/html, Size: 1421 bytes --]
next prev parent reply other threads:[~2023-08-24 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 14:40 Pier Paolo Grassi
2023-08-24 3:20 ` Bart Schaefer
2023-08-24 14:01 ` Pier Paolo Grassi [this message]
2023-08-24 17:47 ` 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='CAP+y1xAPkaACMYJr93qibBKSmPYW2D3MYShWwA9xdKz=ejd7NQ@mail.gmail.com' \
--to=pierpaolog@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@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).