Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: widget accept-no-history
- X-seq: zsh-users 29194
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: widget accept-no-history
- Date: Wed, 23 Aug 2023 20:20:39 -0700
- Archived-at: <https://zsh.org/users/29194>
- In-reply-to: <CAP+y1xCDmEVdVgs29L-pWYEdwtKieSFhyuWBBRd9=zQb=Y2Csg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAP+y1xCDmEVdVgs29L-pWYEdwtKieSFhyuWBBRd9=zQb=Y2Csg@mail.gmail.com>
On Wed, Aug 23, 2023 at 7:41 AM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author