How can I get whether the command being typed is multiline?

$CONTEXT can determine when at a secondary prompt like:

$ echo 'hello
quote> world'

But how can I determine when there's a newline like:

$ echo 'hello

(Doable in vi mode or with self-insert-unmeta)

I need this info in a ZLE widget.


The complete content of the logical input line is in BUFFER.

[[ $BUFFER == *$'\n'* ]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.