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

Re: Assigning BUFFER in accept-line kills comp remove logic



On Wed, Aug 20, 2025 at 8:10 AM Jörg Sommer <joerg@xxxxxxxx> wrote:
>
> I have a function `accept-line` to modify the BUFFER before it goes into
> execution and into the history. Unfortunately, an assignment to BUFFER kills
> the logic that removes completion suggestions like SPACE, / or =.
>
[...]
>
> Is it possible to get this behaviour back?

You have to handle it yourself.  There are ZLE variables to help.

accept-line () {
  if (( SUFFIX_ACTIVE ))
  then
    BUFFER="${BUFFER[1,SUFFIX_START]}"
  else
    BUFFER="$BUFFER"
  fi
  zle .accept_line
}




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