Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: commit to history
On Fri, Aug 27, 2021 at 2:15 PM Pier Paolo Grassi <pierpaolog@xxxxxxxxx> wrote:
>
> the send-break widget returns a status code 1, and since I have a precmd that displays the last status code, I was wondering if it is in some way possibile to suppress that return status.
The short answer is no, there is not. There was a long thread about
this on zsh-workers earlier this year, search "curious incident of the
feep".
As written your widget discards multi-line structures if invoked at
the PS2 prompt. If that's intentional you can replace with:
commit_to_history() {
print -rs -- ${(q)${(z)BUFFER}}
BUFFER=''
if [[ -n $PREBUFFER ]]
then zle accept-line
else zle send-break
fi
}
If you would prefer to capture multi-line structure at PS2,
commit_to_history() {
local fullbuffer="$PREBUFFER$BUFFER"
print -rs -- ${(q)${(z)fullbuffer}}
BUFFER=''
if [[ -n $PREBUFFER ]]
then zle accept-line
else zle send-break
fi
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author