Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: widget accept-no-history



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