I answered myself withautoload -U add-zle-hook-widgetPier Paolo GrassiIl giorno lun 17 ott 2022 alle ore 11:19 Pier Paolo Grassi <pierpaolog@xxxxxxxxx> ha scritto:add-zle-hook-widget
zsh: command not found: add-zle-hook-widgetlocate add-zle-hook-widget
/usr/local/share/zsh/5.8/functions/_add-zle-hook-widget
/usr/local/share/zsh/5.8/functions/_add-zle-hook-widget.zwc
/usr/local/share/zsh/5.8/functions/add-zle-hook-widget
/usr/local/share/zsh/5.8/functions/add-zle-hook-widget.zwcecho $fpath
/root/scripts//zsh/functions/zle/ /usr/local/share/zsh/5.8/functions/why the command is not found? Should I do something to load the functions from fpath?thanksPier Paolo GrassiIl giorno lun 17 ott 2022 alle ore 06:22 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> ha scritto:On Sun, Oct 16, 2022 at 8:40 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2022-10-16 18:07, Bart Schaefer wrote:
> > You might find something like this interesting:
> That is really elegant.
Actually that implementation is kind of ugly. I completely forgot
about this much prettier way:
show-trailing-space() {
if [[ $BUFFER = *(' '|$' \n'*)
|| $PREBUFFER = *$' \n'* ]]
then POSTDISPLAY=$'\u21a9'
else unset POSTDISPLAY
fi
}
zle -N show-trailing-space
add-zle-hook-widget line-pre-redraw show-trailing-space
add-zle-hook-widget history-line-set show-trailing-space