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

Re: line continuation with sed



When the buffer is on multiple lines there is this corner case (zsh 5.8):

E \  
cdcd↩

ie the space is on the first line but the eol marker is on the last line of the buffer, is there a POSTDISPLAY equivalent at row level?

Pier Paolo Grassi


Il giorno lun 17 ott 2022 alle ore 11:24 Pier Paolo Grassi <pierpaolog@xxxxxxxxx> ha scritto:
I answered myself with

autoload -U add-zle-hook-widget

Pier Paolo Grassi


Il 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-widget

locate 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.zwc

echo $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?
thanks

Pier Paolo Grassi


Il 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



Messages sorted by: Reverse Date, Date, Thread, Author