Re: A ZLE widget for calculator

Vincent Bernat <[email protected]> Tue, 24 Mar 2026 22:52:27 +0100
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>
On 2026-02-08 16:06, Vincent Bernat wrote:

>> I think the attached does what you want.  It's based on the
>> modify-$BUFFER + .accept-line variation because among other things
>> that has the advantage of working at the PS2 prompt.  It
>> unconditionally removes and re-adds quotes.  The original $BUFFER is
>> saved in a global variable which is then added to the history by the
>> preexec hook, after suppressing the automatic history with
>> zshaddhistory hook.  This could probably use a function instead of an
>> alias for "=", but I didn't change that.
> 
> Thanks, it works perfectly!

FI, I have written a short blog post about this: 
https://vincent.bernat.ch/en/blog/2026-zsh-calculator

Thanks again!